Unity 2017 - read_phone_state permission, cant remove

Hey unity forum, I am trying to upload my game to the google play store, however it keeps stating that its asking for “read_phone_state” permissions, now I know that one cause of this is using systeminfo, so I have removed all references to systeminfo.

I also read somewhere that WWW causes the permission to be added, so removed any use of that as well.
I am using Unity analytics so was wondering if this could be the cause?
If not what are possible causes for this permission to be added, or is this just a bug on unity’s end, as I remember this permission being added by a bug in a previous version of Unity.

Thanks for reading

1 Like

If your project has an AndroidManifest.xml, then try setting a minSdkVersion value there that is greater than 3 (source: https://stackoverflow.com/questions…-state-permission-although-its-not-declared-i).

1 Like

@CavElliott follow this link : Unity Issue Tracker - [Android] READ_PHONE_STATE permission is added in the AndroidManifest.xml file using latest (26.0.2) SDK

This is a huge problem for me and my company. How can we get rid of READ_PHONE_STATE!!!

We’ve been manually removing it for years but now we cant get rid of it!

2 Likes

suffering from the same thing here…on an empty project, sure, no permission added, but on our current one, nothing gets rid of it. Tried removing all plugins, setting minSdk, everything…Unity is doing little to adress the issue.

I have seen thousands of posts talking about the similar issue. It is agreed that Unity injects additional permissions in the build phase. The thing we should ask if you ask me, is “Are there any ways to find and list the things causing that injection?”… Thus we can get rid of that part right!?..

PS: I am having the same problem in 5.3.5. It is ironic to still have it in 2017…

Hard to find what adds it without removing things step by step. We have a plugin that added it in by accident.

However, you can decompile the apk with apktool and remove it then resign/rezip - this is what we do when a plugin etc adds it in by accident. Not ideal but it should be fairly easy to automate this.

modify UnityChannel.aar
there is your problem.
Remove permissions from their manifest

It’s working fine for me

1 Like

Where do you find this file? It’s not in the project.
Not really a solution either.

I dont know why, but in our projects
from time to time it permeates to AndroidManifest.xml while build for GooglePlay

PS
and look instde aapt folder to

So, all of a sudden I seem to be running into this issue as well. Every time a build and install the APK file, I get prompted to allow my game to “Make and Manage Phone Calls.

I have tried removing every instance of ‘READ_PHONE_STATE’ from every Android Manifest file in the directory. I have gone through and altered all of the Manifest files to have matching minSDK and targetSDKs.

After I build my project, I can find an instance of ‘READ_PHONE_STATE’ in the Manifest file under - *\unity\Temp\StagingArea.

I am at a loss for what to do next. Any help would be greatly appreciated.

1 Like

you can remove it permission in main manifest

3 Likes

Where is the data located? Cant find it…

Edit:
Its working with modifying the manifest int “unityChannel” as you descriped! Thanks

Tried it. Error: “XmlException: ‘tools’ is undeclared namespace.”

Unity 5.5.5f1. Do you know why this could be happen?

You’ll need to add the bit in bold to your manifest at the top…

manifest … xmlns:tools=“http://schemas.android.com/tools>

1 Like

If you are building for Xiaomi and using UnityChannel, this is a permission requirement by Xiaomi.

I’m getting this permission in my builds today for what appears to be no reason. I don’t use Xiaomi. I can’t understand it.

Here is a more complete picture of what is going on:

  1. IF Android API level is less than 4* then this permission is added.
  2. Our Unity projects will often have more than one Android Manifest. If one of them does not specify the minimum target, it will assume API 1 which is less than 4. If it thinks you are using something less than 4, this permission is added.
  3. To “fix” the permission prompt you can add 2 lines to your manifest as described here.
    (namespace for tools and a remove line for the phone).
    https://answers.unity.com/questions/1363944/deleare-read-phone-state-unity-55.html?childToView=1433985
  4. If however, you are trying to put this on Google Play, and you don’t have privacy statement (and don’t want one), then the solution above is not for you. what you need to do, is to search for Android Manifest in your project and make sure that every one has a minimum API greater than 4. For example,

*Note: If you are wondering…what is she talking about API level 1, then please look here…
http://mobisir.net/android-name-version-api-level/ . In short, you want Android 2.0 and up.

2 Likes

Just adding this to the main AndroidMannifest solved the problem for me.

1 Like

I wouldn’t remove the write and read external storage permissions, instead set their maxSDK to 18 as they are still required for old android versions