'Android - deep link - got null categories from intent
My app can be opened with deep link. When clicking a link in an email from the Outlook Android app, my app is opened. But, the Intent
doesn't contain any categories. In my activity, getIntent().getCategories()
returns null
.
The same link works fine in the Gmail app on the same device. The app is opened and getIntent().getCategories()
returns a list with Intent.CATEGORY_BROWSABLE
in it.
Does it mean when a app is opened from deep link, it doesn't always get category in the Intent
?
Solution 1:[1]
Check out that you getting getIntent()
onResume
@Override
protected void onResume() {
super.onResume();
if(getIntent() != null){
// do something
}
}
if still no luck, then check onNewIntent
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if(intent != null){
// do something
}
}
I had the same issue, and totally forgot about overriding the onNewIntent
method in the activity.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ivan Bila |