For some time now I'm trying to pass the simple one String
data from the Service
to the Activity
with Intent.putExtra()
but with no success however. Intent.getStringExtra()
is always NULL
SERVICE CODE:
Intent intent=new Intent(getBaseContext(),MainActivity.class);
intent.putExtra(Consts.INTERNET_ERROR, "error");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplication().startActivity(intent);
ACTIVITY CODE:
public void onResume() {
super.onResume();
Intent i = getIntent();
String test = "temp";
Bundle b = i.getExtras();
if (b != null) {
test = b.getString(Consts.INTERNET_ERROR);
}
}
Any suggestions?