I'm starting a service with an intent where I put extra information.
How can I get the intent in the code of my service?
There isn't a function like getIntent().getExtras()
in service like in activity.
I'm starting a service with an intent where I put extra information.
How can I get the intent in the code of my service?
There isn't a function like getIntent().getExtras()
in service like in activity.
onStart()
is deprecated now. You should useonStartCommand(Intent, int, int)
instead.To pass the extras:
To retrieve the extras in the service:
Override
onStart()
-- you receive theIntent
as a parameter.