Hi,
I am trying to mimic INSTALL_REFERRER intents from Google Play using adb shell am. I’m having some issues when my application ID in Gradle is different than my package name in my Manifest.
In my manifest, I define my BroadcastReceiver as:
<receiver
android:name=“.BroadcastReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER"/>
</intent-filter>
</receiver>
and my package is “com.example.package”.
In my app build.gradle file, I define my application ID:
productFlavors {
flavor {
applicationId ‘com.flavor.applicationID'
versionName ‘1.0.0'
}
}
What I am seeing, is that my BroadcastReceiver is not able to receive an explicit INSTALL_REFERRER intent unless the component specifying the name of the BroadcastReceiver includes the package name:
# fail
am broadcast -a com.android.vending.INSTALL_REFERRER -n com.flavor.applicationID/.BroadcastReceiver --es "referrer" "test_referrer=test”
# fail
am broadcast -a com.android.vending.INSTALL_REFERRER -n com.flavor.applicationID/com.flavor.applicationID.BroadcastReceiver --es "referrer" "test_referrer=test”
# fail
am broadcast -a com.android.vending.INSTALL_REFERRER -n com.example.package/com.example.package.BroadcastReceiver --es "referrer" "test_referrer=test”
# success
am broadcast -a com.android.vending.INSTALL_REFERRER -n com.flavor.applicationID/com.example.package.BroadcastReceiver --es "referrer" "test_referrer=test”
I’m wondering why my BroadcastReceiver does not receive the intent unless the package name is explicitly in the BroadcastReceiver’s name. I’m also wondering how Google Play sends the INSTALL_REFERRER intent - I believe intents use the "com.flavor.applicationID/.BroadcastReceiver” component and I’m missing INSTALL intents. If I explicitly specify the package name as the name of my BroadcastReceiver (com.example.package.BroadcastReceiver) in my Manifest, would Android still be able to route intents from Google Play to my BroadcastReceiver?
Thanks!
Best regards,
Michael Sung
--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.