Title self explanatory, how can I do that?
I've tried classic intent method but the getIntent() part doesn't work inside my activity extends IntentService..
Title self explanatory, how can I do that?
I've tried classic intent method but the getIntent() part doesn't work inside my activity extends IntentService..
You don't need to call getIntent()
from the IntentService.
You get the intent as a parameter when your IntentService starts running (with onHandleIntent()
). You can then read the extras normally with getStringExtra()
. Check the code below:
@Override
protected void onHandleIntent(Intent intent) {
String username = intent.getStringExtra("key_1");
String password = intent.getStringExtra("key_2");
// Code here ...
}
Check this link for more: Using putExtra to pass values to intent service