Leanplum / Leanplum-Android-SDK

Leanplum's integrated solution delivers meaningful engagement across messaging and the in-app experience.
https://www.leanplum.com
Apache License 2.0
46 stars 40 forks source link

Fix deeplinks for Android 11 #455

Closed hborisoff closed 3 years ago

hborisoff commented 3 years ago
What Where/Who
JIRA Issue LP-11805
People Involved @hborisoff

Android 11 introduces some restrictions on package visibility. Querying for activities (queryIntentActivities) will produce empty list if activities are not from the same app, unless <queries> tags are defined in the manifest, specifying all needed apps.

Changed handling of deeplinks in two places:

  1. When push notification with Open URL action is clicked
  2. When in-app message of type Open URL is triggered

If current app handles the intent then the activity class is set in the intent and chooser dialog would not be shown.

If other app handles the intent then startActivity(...) is called directly. This will popup chooser dialog if there are more than one registered apps for that URI. There is a possibility that startActivity(...) would throw ActivityNotFoundException. In that case the app is opened instead of the deeplink.