Ionic v4 Play Store android.permission.READ_PHONE_STATE [SOLVED]

I’m uploading an ionic v4 application to play store and apk upload, I have this error:

  • Your APK or Android App Bundle uses permissions that require a privacy policy: (android.permission.READ_PHONE_STATE).

I’ve seen several ideas on how to work on native android, but not on ionic framwork. Any suggestion?

You can add that permission via the config.xml file.

See: http://docs.phonegap.com/phonegap-build/configuring/config-file-element/ for more information on this

<config-file platform="android" parent="/manifest" mode="merge">

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

</config-file>

so it did not work … ionic config.xml

...
<platform name="android">
        <allow-intent href="market:*" />
        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
        <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
        <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
        <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
        <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
        <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
        <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
        <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
        <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
        <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
        <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
        <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
        <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
        <resource-file src="google-services.json" target="app/google-services.json" />
        **<uses-permission android:name="android.permission.READ_PHONE_STATE" />**
        
    </platform>
...

I think that you need to include all of the it, not just the use-permission.

<config-file platform="android" parent="/manifest" mode="merge">
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
</config-file>
1 Like

I got it. As it was my first app in the Play Store, I did not know the need to include the privacy policy in the google play console. :wink:

I don’t know if something changed, but in ionic 5 you must add it like this.

        <config-file mode="merge" parent="/manifest" platform="android" xmlns:android="http://schemas.android.com/apk/res/android">
            <uses-permission android:name="android.permission.READ_PHONE_STATE" />
        </config-file>