Forum Xamarin.Android

New Behavior when adding GCM to project - it adds lines to AndroidManifest.xml - which are wrong

GerryHighGerryHigh USBeta ✭✭✭
edited February 2016 in Xamarin.Android

It's been a number of months since I've messed with an app that uses GCM. In the process of updating it from the GooglePlayServices - All (since it is deprecated) to the individual packages I've noticed a new behavior which is wrecking my deployment.

Just by adding Xamarin.GooglePlayServices.GCM to your packages it then adds at compile time lines to the AndroidManifest.xml which are not what I want.

For example, if my Package Name is Jon.Dick it adds the following lines:

  <permission android:name="Jon.Dick.permission.C2D_MESSAGE" />
  <uses-permission android:name="Jon.Dick.permission.C2D_MESSAGE" />

We know that won't work since GCM doesn't allow uppercase permissions. Even if I add lines to my project file (or use the [assembly: PermissionName...] such as

  <permission android:name="jon.dick.permission.C2D_MESSAGE" />
  <uses-permission android:name="jon.dick.permission.C2D_MESSAGE" />

It doesn't see those lines and then adds duplicates with the mixed case. Once the apk is then installed to the device it fails with the dreaded "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED" due to the permissions. The actual message is "Bad class name Jon.Dick.permission.C2D_MESSAGE in package Jon.Dick

Is there a way to turn off the auto-generation of these lines at build time? This app has worked fine for a few years with this approach.



Sign In or Register to comment.