There are roughly two ways of using the service in Android,Context.startService() and Context.bindService().
Context.startService(): can be used only by one application.
Context.bindService(): could be exposed to other applications.
Here we focuse on Context.bindService().
bindService() -> onCreate() -> onBind() ->onServiceConnected()-> running.
There is one thing we have to notice.
The onServiceConnected() may not be called immediately and this might cause some problem!
Ref:
http://stackoverflow.com/questions/2486692/onserviceconnected-never-called-after-bindservice-method
沒有留言:
張貼留言