Reputation: 11944
Hi I am passing an intent with some data to start a service but I am unable to retrieve my strings ,as my OnCreate()
method of the Service is called first and I have all the work in it but I am not able to retrieve intent data in this method..
Upvotes: 1
Views: 823
Reputation: 1007554
Intent extras are for use with commands (onStartCommand()
), or possibly with requests to bind (onBind()
). There is no Intent
associated with simply creating the service.
Rewrite your service to do the work that is customized by the Intent
extras in onStartCommand()
or onBind()
. Or, consider whether Intent
extras are the right approach to use -- for example, I would expect that things a Service
needs all of the time would be available in a database or SharedPreferences
.
Upvotes: 2