How to force restart activity from intention

Mine MainActivityhaslauchMode="singleTask"

Now I want to get started with a notification with special intent data. in MainActivity.onResumeI get access to the given intent data ...

The problem is this: when the activity already exists, and I click on the notification, the action comes to the fore, but the method is onResumenot called, and I can not access the intent data.

I tried the flag FLAG_ACTIVITY_CLEAR_TASKand this works for Honeycomb, but not for Gingerbread.

This is how I run the action from the notification:

Intent intent = new Intent();
intent.setClass(this, MainActivity.class);
intent.putExtra("triggerid", triggerid); 
startActivity(intent);
+5
source share
1 answer

onResume() , . , , , , , getIntent() , , , .

, onNewIntent(). , . setIntent() , getIntent() onResume().

+9

All Articles