My news application runs in the background and if there is any update in news a notification will show in the status bar.
How can I identify that my application is opened by tapping the notification or opened directly?
Try this out
you can add some extra data to your starting intent when you start them using Boundle Object.So when you creat PendingIntent form your notification add following.
Boundle b=new Bundle();
b.putString("from","fromNotification");
intent.putExtras(b);
and after that in your starting activity check that.
Bundle b=getIntent().getExtras();
String startedForm=b.getString("form");
now you can decide where it came from.if startedFrom
is null
then it has started directly or else if it is "fromNotification
" then it has started by notification