Uppercase package name not allowed in C2D_MESSAGE permission

I've just added the Xamarin.Firebase.Messaging (<package id="Xamarin.Firebase.Messaging" version="60.1142.1" targetFramework="monoandroid81" />) nuget package to my Xamarin Android app, and now a lot of app users (3000-4000 users) cannot install the app.

The reason is that the FCM library automatically injects the C2D_MESSAGE permission into the generated manifest, with our package name as a prefix. Our package name has uppercase letters, like Xxx.Yyy.Zzz so the permission in the final manifest becomes:

<permission android:name="Xxx.Yyy.Zzz.permission.C2D_MESSAGE" android:protectionLevel="0x2" />
<uses-permission android:name="Xxx.Yyy.Zzz.permission.C2D_MESSAGE" />

It seems like this is not accepted by some mobile phone brands, as when trying to install the app the user get:

mFinalMessage=Failed parse during installPackageLI: /data/app/vmdl518178908.tmp/base.apk (at Binary XML file line #1 22): Bad class name Xxx.Yyy.Zzz.permission.C2D_MESSAGE in package Xxx.Yyy.Zzz

Same problem is reported in discussion 61727/new-behavior-when-adding-gcm-to-project-it-adds-lines-to-androidmanifest-xml-which-are-wrong for the old GCM package.

This issue also discusses a related feature xamarin/xamarin-android/issues/1335

Does anyone know if there is a solution or workaround to fix this problem?

  1. I do not want to change my application name to be lowercase, as this will be treated as a new app on Google Play Store
  2. I do not want to remove FCM

Posts

  • borge_rodsjoborge_rodsjo NOMember ✭✭

    With some help from Claudiu Cheles and Redth I am now using an msbuild XmlPoke at the correct build step to set correct package name of these C2D_MESSAGE permissions. See github.com/xamarin/xamarin-android/pull/2402 and gist.github.com/Redth/9d74a2caaf6654229b5c8c921e30748d

Sign In or Register to comment.