TobiasBuchholz / Plugin.Firebase

Wrapper around the native Android and iOS Firebase Xamarin SDKs
MIT License
220 stars 49 forks source link

Plugin.Firebase requires AD_ID permission? #147

Closed andyzukunft closed 1 year ago

andyzukunft commented 1 year ago

Hey,

trying to release my app with Firebase.Plugin integration on Google Play Store shows that I need to modify my AD_ID declaration to "YES, I use AD_ID" and enable com.google.android.gms.permission.AD_ID in the AndroidManifest.xml.

Can this be an introduction of the Facebook components or are you aware where this is coming from?

Kapusch commented 1 year ago

Hi @andyzukunft , did you introduce ads in your app recently ? I remember I had to add this permission after having introduced Google Ads

andyzukunft commented 1 year ago

That's the thing. Between the last test release end of February and today I only added:

Project File (.csproj)

<PackageReference Include="Plugin.Firebase" Version="1.3.0" />
<PackageReference Include="Xamarin.Build.Download" Version="0.11.4" />
<PackageReference Include="Xamarin.GooglePlayServices.Gcm" Version="117.0.0.8" />

<AndroidResource Update="Platforms\Android\Resources\values\strings.xml">
  <Generator>MSBuild:UpdateGeneratedFiles</Generator>
</AndroidResource>

AndroidManifest.xml

<application android:allowBackup="true" android:icon="@mipmap/app_icon" android:supportsRtl="true">
    <!-- firebase cloud message -->
    <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_notification_small" />
    <receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />
    <receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:exported="true" 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>

    <uses-permission android:name="android.permission.POST_NOTIFICATION" />
</application>

Strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="com.google.firebase.crashlytics.mapping_file_id">none</string>
</resources>

The compiler flags are abridged. So in other words I added the mandatory stuff for Plugin.Firebase.

I also updated my Android SDKs but this shouldn't affect AD_ID. At the moment I do not target Android 33 explicitly but instead use the implicit targeting which defaults to the highest installed framework (based on MS documentation) which is Android 33 on the machine.

Kapusch commented 1 year ago

Actually @andyzukunft , I just retrieved this excerpt from the Google Play Console help:

[...] when apps update their target to Android 13 or above will need to declare a Google Play services normal permission in the manifest file [...]

cf: https://support.google.com/googleplay/android-developer/answer/6048248

andyzukunft commented 1 year ago

Hey Kapusch,

I read the documentation but thanks for pointing it out. However it seems (I checked) that something is adding com.google.android.gms.permission.AD_ID to the manifest file on compilation which then clashes with my Play Console configuration.

I tried adding

AndroidManifest.xml

<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove" />

but this does not help.

Sebosek commented 1 year ago

Same problem here, basically an empty MAUI project with Plugin.Firebase I am unable to release, even in Alpha testing. The Plugin.Firebase in version 2.0.1.

Update: there is an ongoing discussion on StackOverflow, please review it, looks like it's by intention...

andyzukunft commented 1 year ago

I tested the behaviour by only referencing Plugin.Firebase.CloudMessaging. This works like a charm, no need for AD_ID definition within the AndroidManifest.xml, no auto-add of this property to this file during the build process and no need to state AD_ID requirement in Google Play Console.

I don't use Analytics but I concur with Google that it is fair to have to define the AD_ID property if analytics is enabled (even if AD_ID might be an improper name in this case).

My issue has been resolved. I will keep it open for the moment in case someone else wants to share some information.