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.
This post says that if you don’t set an
Actionon yourIntentthat the extras won’t be passed along. SO you should try that.