We have an app with an Activity that can be started in two ways:
As far as I can see this is always working just fine. We either get the Intent.ACTION_VIEW
with a data URI, or we get some string extras.
However, we have a very few instances where action is Intent.ACTION_MAIN
and there are no extra data.
The toString()
of the Intent is as follows (class name changed):
Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10400000 cmp=com.example.OurActivity }
Intent.getExtras()
returns null, Intent.getDataString()
returns null.
In which cases can this happen? Why is the category for the Activity Intent.CATEGORY_LAUNCHER
? How can we get the data needed to show the user the right contents?
launchMode
is not specified for the Activity. The only IntentFilter
in AndroidManifest.xml
is for the deep linking (and not the launcher category).
The issue happens on Android 4-6 on a wide range of devices.
Edit: Forgot to mention the flags:
As the print out suggests the flags for the Intent are FLAG_ACTIVITY_NEW_TASK
and FLAG_ACTIVITY_BROUGHT_TO_FRONT
. I suppose that could be relevant here.
I believe, I nailed it:
There're launchers, like Nova Launcher which allows users to start with any of app's Activities
, instead of the normal flow:
For example, you can add a shortcut on your desktop to start Gmail client with Account setup Activity.
And in this case, Activity is being started with empty Extras
and technically it becomes a launcher's Activity
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With