I am trying to run an application with additional features from a notification. I get the launch intent for it using:
Intent launchIntentForApp = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
Note. The context of the same application. I am trying to create a library that can be used in my other applications.
I will add some additional features:
launchIntentForApp.putExtra("test", true);
Then I create a pending intent for it and add it to the notification box:
PendingIntent pIntent = PendingIntent.getActivity(context, 0, launchIntentForApp, 0);
Notification n = new Notification.Builder(context)
.setContentTitle(notifTitle)
.setContentText(notifMessage)
.setContentIntent(pIntent)
.setAutoCancel(true)
.setStyle(new Notification.BigTextStyle()
.bigText(notifMessage))
.setSmallIcon(R.color.transparent)
.build();
NotificationManager notificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, n);
However, when the action runs in this application, in onCreate () of this action, null is always returned:
Bundle extras = getIntent().getExtras();
How can I send additional information to the main application of this application?