cancel
Showing results for 
Search instead for 
Did you mean: 

Keep Getting error called android.permission.Read_phone_state.

UltimaVYT
Explorer

Screenshot (2).pngIF ANYONE KNOWS A FIX COMMENT ON THIS POST

10 REPLIES 10

MK1_Dev
Explorer

I am also getting the same messages regarding read phone state and 32 bit libraries.  Have never had these issues before.

007x007
Expert Protege

You can't do anything yourself. Only the author of this application.

This is a requirement of Android 11. The permission policy for READ_PHONE_STATE has been changed.

 

https://developer.android.com/about/versions/11/privacy/permissions?hl=en
....
"If your app targets Android 11 or higher and needs to access the phone number APIs shown in the following list, you must request the READ_PHONE_NUMBERS permission, instead of the READ_PHONE_STATE permission."
...

 

All you can do is report the issue to the app developer so they can comply with Google's guidelines.

Theres no solution??

 

i am the app dev

 

If Your are that app dev, then find the "Phone numbers" section on the page:

https://
developer.android.com/about/versions/11/privacy/permissions?hl=en

Everything is explained in detail (with an example) what you need to do for Android 11+ 😊 Look at attached picture.

You only need to make a minor change to the AndroidManifest.xml file, compile and upload a new apk/aab file.

jakobanarkylabs
Explorer

It seems that the Unity Editor, from version 2022.3.39 and onwards, have started automatically adding some new permissions to the AndroidManifest.xml. See this post:
https://discussions.unity.com/t/unnecessary-additional-permissions-in-lts-unity-versions-2022-3-39f1...
I had the same problem when trying 2022.3.40. Haven't yet tried 2022.3.41.
Maybe the best way at the moment would be to manually specify in the custom AndroidManifest.xml that the permission android.permission.READ_PHONE_STATE should be removed:

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

Make sure that the manifest is including tools:

xmlns:tools="http://schemas.android.com/tools"

 

This helped, tnx.
I just don't get how when I export gradle project and navigate to AndroidManifest, there is no this permission defined, but in the generated APK from it, the permission is present.

jakobanarkylabs
Explorer

Great 🙂
It is because the final AndroidManifest.xml that ends up in the built APK is a combination of many things, where just one of them is the potential custom AndroidManifest.xml in Assets/Plugins/Android/.
But all sorts of things are going on in the build process that might add various stuff to the final AndroidManifest.xml.

jakobanarkylabs
Explorer

Ah, ok. I didn't understand that you were talking about the AndroidManifest created when you export to gradle project - sorry. But I guess that something is happening when the gradle project is being built.
I found this post explaining some methods for detecting the source of a permission in the final AndroidManifest: https://stackoverflow.com/a/52933901/17417673