How to detect if an app is opened from custom url or notification - android -
i'm working on app in android. can opened both custom url , notification (when user clicks on it). i've learned how both , know working correctly. want know how can detect when it's open url , when notification (it has difference when handle in main activity).
thanks help!
it pretty simple. set boolean in intent , when activity opened check if opened custom url or notification.
let's setting intent notification following, put in intent:
intent intent = new intent(context, mainactivity.class); intent.putextra("is_from_notification",true);
in oncreate method of activity check value
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); boolean isfromnotification = getintent().getbooleanextra("is_from_notification",false); }
Comments
Post a Comment