2

This is unique question in a sense that I am passing stringExtra to start the IntentService as opposed to the question that simply starts a service from within a service(my question is labeled as possible duplicate of). I am trying to start IntentService from a GcmIntentService by passing intent as such. Is it at all possible? Or I have to send the data to a broadcast receiver in the activity and pass them to the intent service? My goal is to send the location updates to a device from a separate thread.

Intent iniupdates = new Intent(this, LocationUpdater.class);
iniupdates.putExtra(LocationUpdater.PARAM_IN_PAS, pa);
iniupdates.putExtra(LocationUpdater.PARAM_IN_DRI, tok);
startService(iniupdates);

I am trying to receive this

@Override
protected void onHandleIntent(Intent intent) {
    if (intent != null) {
        pa = intent.getStringExtra(PARAM_IN_PAS);
        dr = intent.getStringExtra(PARAM_IN_DRI);
        Log.e("onhandle", dr);
    } else{
        Log.e("ERROR", "YOUR INTENT IS NULL");
    }
}

But I am not getting anything. I don't even see that my IntentService is started.

The_Martian
  • 3,684
  • 5
  • 33
  • 61
  • 1
    Refer [this](http://stackoverflow.com/questions/3888602/startservice-from-the-service-class-itself) answer.This might help you. – Jas Oct 08 '15 at 08:29
  • That question addresses a scenario where you want to start a service from an Activity. I would like to start IntentService from another service(GcmIntentService) by adding some stringExtra. The IntentService is not started and if I declare it in manifest I get npe which is odd. – The_Martian Oct 08 '15 at 18:08

0 Answers0