Android service onBind & # 8594; onStart

I have a question about Android services. I have a Service that performs background HTTP operations and an activity that should display the current status of these HTTP operations.

So, I implement the Binder interface, etc. I can call the bindService method, and the onServiceConnected of my ServiceConnnection receives the call. But as far as I know, onBind does not call onStartCommand (), and therefore the onStart () service is never called.

So, how can I call the onStart () method of the service class and start my operations. Or how best to start my operations in the service, when I also need a binding between Activity and the service.

+3
source share
1 answer

, onBind onStartCommand() onStart() .

.

, onStart() .

startService() bindService(). onStart() " [] " - API .

+5

Source: https://habr.com/ru/post/1741413/


All Articles