Answer the question
In order to leave comments, you need to log in
How to make Notification in android be a link to the application?
Good afternoon!
I'm trying to make it so that when the application window is minimized, a notification is sent, which would hang in the status bar until the application was closed and at the same time be a link to the application to return to it. It seems that everything works, except that when you click on the notification, the application does not open.
I do it like this:
Intent notificationIntent = new Intent(this, CordovaActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
mNotificationManager.notify(NOTIFY_ID, notification);
Answer the question
In order to leave comments, you need to log in
The problem was solved by getting the intent like this:
PackageManager pm = getPackageManager();
Intent notificationIntent = pm.getLaunchIntentForPackage(getApplicationContext().getPackageName());
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question