Say I have app A and B. App B has multiple build flavors but each one is slightly different and I want to launch a specific flavor from app A.
I have considered using one custom shared intent but I don't want the OS to prompt the user about which version to use to handle the intent if they have multiple versions of B installed.
Is it possible to programatically define unique custom intents for each flavor of an application?
In order to use one shared AndroidManifest between multiple flavors and have unique intents for each I added a manifest placeholder for each flavor in build.gradle
default {
manifestPlaceholders = [uriPrefix: "myprefix"]
}
someFlavor{
manifestPlaceholders = [uriPrefix: "otherprefix"]
}
In AndroidManfest.xml use a manifest placeholder like so in the intent filter:
<intent-filter>
<action android:name="com.custom.app.${uriPrefix}.SOME_ACTION" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="${uriPrefix}" />
</intent-filter>
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