I am using stopService()
to stop the service . and I want to send Extra data with the intent . how to retrieve this extra data in the service ??
Work is submitted to the queue by creating an Intent and then passing that Intent to the StartService method. It is not possible to stop or interrupt the OnHandleIntent method IntentService while it is working.
Stopping a service. You stop a service via the stopService() method. No matter how frequently you called the startService(intent) method, one call to the stopService() method stops the service. A service can terminate itself by calling the stopSelf() method.
To start the service, call startService(intent) and to stop the service, call stopService(intent) .
IntentService runs outside the application in a background process, so the process would run even if your application is closed.
AFAIK, this Intent
is not delivered to the Service
in any fashion.
Instead of stopService()
, you can use startService()
to pass your extras, and include something in there that causes your service to call stopSelf()
. This will have the net effect of calling stopService()
and supplying extra data at the same time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With