java - Android GCM with product flavors -
i have gcm sample android gradle project. worked well, when add 2 flavors push notification stopped work. compilation manifest (it's taken app\build\intermediates\manifests\ex\debug
) file below:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.flavor.app" <uses-permission android:name="com.flavor.app.permission.c2d_message" /> <permission android:name="com.flavor.app.permission.c2d_message" android:protectionlevel="signature" /> <receiver android:name="com.google.android.gcm.gcmbroadcastreceiver" android:permission="com.google.android.c2dm.permission.send" > <intent-filter> <action android:name="com.google.android.c2dm.intent.receive" /> <action android:name="com.google.android.c2dm.intent.registration" /> <category android:name="com.flavor.app" /> </intent-filter> </receiver> <service android:name="com.ex.app.gcmintentservice" /> <service android:name="com.ex.app.applocationservice" class=".applocationservice" > <intent-filter> <action android:name=".applocationservice" android:value=".applocationservice" /> </intent-filter> </service>
what should fix problem? please help.
upd1. using gradle v.0.12+. think final manifest file looks good, gcmregistrar.checkmanifest(this); - without errors, gcmregistrar.isregistered(this) false. =(
upd2. first flavor project original package name (as project in main branch) works well, second flavor changed package doesn't work (registrationid push still empty), in manifest file permitions correct.
simpy use ${applicationid}
alias this
<permission android:name= "${applicationid}.permission.c2d_message" android:protectionlevel= "signature" /> <uses-permission android:name= "${applicationid}.permission.c2d_message" /> <uses-permission android:name= "com.google.android.c2dm.permission.receive" />
and corresponding receiver use this
<receiver android:name = "com.mixpanel.android.mpmetrics.gcmreceiver" android:permission = "com.google.android.c2dm.permission.send"> <intent-filter> <action android:name = "com.google.android.c2dm.intent.receive"/> <action android:name = "com.google.android.c2dm.intent.registration"/> <category android:name = "${applicationid}"/> </intent-filter> </receiver>
Comments
Post a Comment