how to check whether the activity was launched from notification or from the user click on home screen dashboard app icon in android. Is there any parameters that tells that this activity was launched due to user clicked on notification..
how to check whether the activity was launched from notification or from the user
Share
There already were several questions on this topic:
home or history
home screen?
As of the home screen part, as far as I know there is no way to detect that.
However, you can detect whether your activity is launched from the notification icon:
When setting up your notification, you put an extra into it’s
PendingIntent, sayfromNotification: boolean.In your main activity’s
onCreatemethod you check the intent’s extras, and if (there are any and) thefromNotificationis among them with the valuetrue, than you know it has been invoked by clikcing on the notification icon.