0

From a Service, I trigger a Notification which, when clicked, has to launch an Activity. To do this, I use the following code :

    notification=new Notification(icone,title,System.currentTimeMillis());
    intent=new Intent(getApplicationContext(),myActivity.class);
    intent.putExtra("org.mypackage.name",true);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    pendingIntent=PendingIntent.getActivity(getApplicationContext(),0,intent,PendingIntent.FLAG_ONE_SHOT);        notification.setLatestEventInfo(getApplicationContext(),title,"Message",pendingIntent);
    notification.flags|=Notification.FLAG_AUTO_CANCEL;
     ((NotificationManager)contexte.getSystemService(Context.NOTIFICATION_SERVICE)).notify("label,0,notification);

When I click on the Notification, the Activity is correctly launched. But it's Intent doesn't contain the extra boolean added with the line intent.putExtra("org.mypackage.name",true);.

Does anyone have an idea of this behaviour?

I can add that I use Android 4.

Thanks in advance for the time you will spend trying to help me.

4

1 に答える 1

1

This post says that if you don't set an Action on your Intent that the extras won't be passed along. SO you should try that.

于 2012-10-12T15:35:33.250 に答える