So, basically what I want to achieve is: get to know when I am accessing the activity through a shortcut and when not. I am using static shortcuts.
Went through the documentation but no luck. Maybe it's related more to the intent, which is a part of Android programming I am not mastering.
Thanks.
Use an action string that is unique to the app shortcut. Note that the action string does not need to be on the <intent-filter>
for the <activity>
in the manifest — the <activity>
does not need an <intent-filter>
at all, AFAIK.
You have to have an android:action
attribute in the <intent>
element for the app shortcut anyway (for inexplicable reasons). So, set that to some string. Then, in your activity, you can use getIntent()
to see the Intent
that was used to create the activity and see if it has this particular action string. If it does, then the activity was created through an app shortcut.