PendingIntent from notification and application history conflicts

Posted by synic on Stack Overflow See other posts from Stack Overflow or by synic
Published on 2010-03-29T23:13:14Z Indexed on 2010/03/30 3:53 UTC
Read the original article Hit count: 401

Filed under:

I'm creating a notification with something similar to the following:

    Intent ni = new Intent(this, SomeActivity.class);
    ni.putExtra("somestring", "somedata");
    PendingIntent contentIntent = 
        PendingIntent.getActivity(this, 0, ni, 
                PendingIntent.FLAG_UPDATE_CURRENT|PendingIntent.FLAG_ONE_SHOT);
    Context context = getApplicationContext();

    notification.setLatestEventInfo(context, 
            res.getString(R.string.app_name), 
            text, contentIntent);

The key here is the extra data on the Intent for the notification. Once I click on the notification and it brings up SomeActivity, it brings up the activity and the extra data is available.

However, if I exit the app, hold the home button until the recent activities list comes up, and choose to open the app again, the extra data is still passed. Is there a way I can make this data get passed only if the app is opened via the Notification, and not from the recent activities list?

© Stack Overflow or respective owner

Related posts about android