Search Unity

Game requests permission to read phone state but NONE of my manifests have that permission in it

Discussion in 'Android' started by Aladine, Apr 9, 2018.

  1. Aladine

    Aladine

    Joined:
    Jul 31, 2013
    Posts:
    195
    Hi,

    The only permission that i see in the manifest files that i have is :

    Code (CSharp):
    1. android.permission.INTERNET
    yet whenever i run the game on device, it asks for permission to read phone and contacts information, when i open the manifest inside Temp\StagingArea i do see the request to read phone state, here is the full manifest content :

    Code (CSharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.hidden.game" android:versionCode="3" android:versionName="2.3" android:installLocation="preferExternal">
    3.   <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="27" />
    4.   <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true" />
    5.   <uses-permission android:name="android.permission.INTERNET" />
    6.   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    7.   <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    8.   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    9.   <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:theme="@style/UnityThemeSelector" android:isGame="false" android:banner="@drawable/app_banner">
    10.     <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:screenOrientation="portrait" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density">
    11.       <intent-filter>
    12.         <action android:name="android.intent.action.MAIN" />
    13.         <category android:name="android.intent.category.LAUNCHER" />
    14.       </intent-filter>
    15.       <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    16.     </activity>
    17.     <meta-data android:name="io.fabric.ApiKey" android:value="70418cbaf12012ef266c9d170326ef4293fef28b" />
    18.     <meta-data android:name="io.fabric.unity.crashlytics.version" android:value="1.2.5" />
    19.     <meta-data android:name="io.fabric.crashlytics.qualified" android:value="com.crashlytics.android.Crashlytics" />
    20.     <meta-data android:name="io.fabric.crashlytics.unqualified" android:value="Crashlytics" />
    21.     <meta-data android:name="io.fabric.kits" android:value="crashlytics" />
    22.     <meta-data android:name="io.fabric.InitializationType" android:value="Automatic" />
    23.     <meta-data android:name="unity.build-id" android:value="f221d2f3-918c-4005-a864-613d5419c9b9" />
    24.     <meta-data android:name="unity.splash-mode" android:value="0" />
    25.     <meta-data android:name="unity.splash-enable" android:value="True" />
    26.     <meta-data android:name="android.max_aspect" android:value="2.1" />
    27.   </application>
    28.   <uses-feature android:glEsVersion="0x00020000" />
    29.   <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    30.   <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
    31.   <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
    32.   <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
    33. </manifest>
    is there any solution to know the cause of this, without having to remove all plugins and add them one by one ?

    Thanks!
     
  2. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    Did you already try doing a search in the project for manifest files? I'd double check every single one to see what they have for permissions.
     
  3. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Make sure all your manifest files have minSdkVersion and targetSdkVersion specified.
     
  4. Aladine

    Aladine

    Joined:
    Jul 31, 2013
    Posts:
    195
    okay will do thanks, but does the versions matters ?
    is this okay to use :

    Code (CSharp):
    1. <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="27" />
     
  5. Aladine

    Aladine

    Joined:
    Jul 31, 2013
    Posts:
    195
    yeah man i did check them all
     
  6. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    Hmm what plugins do you use?
     
  7. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
  8. Aladine

    Aladine

    Joined:
    Jul 31, 2013
    Posts:
    195
  9. Aladine

    Aladine

    Joined:
    Jul 31, 2013
    Posts:
    195
    • Google AdMob Mediation (Unity Ads, Vungle, AdMob)
    • Fabric Crashlytics
    • Game Analytics
    • Google Play Games
    • Easy Mobile Pro (from the asset store) to do Native functionalities (sharing, rating, native pop-up)
     
  10. Aladine

    Aladine

    Joined:
    Jul 31, 2013
    Posts:
    195
    Hi again,

    After making sure all "exposed" AndroidManifest files are correct, i started digging into .aar files, and found that the the only one that is asking for the READ_PHONE_STATE permission is actually The official Unity Purchasing plugin


    that screenshot is from : Assets\Plugins\UnityPurchasing\Bin\Android\CloudMoolah.aar\AndroidManifest.xml

    EDIT: this issue actually started happened after updating unity IAP ~2 weeks ago.

    so i removed that and updated the .aar file, but the game is still asking for that permission.
    This got me thinking about your minimum SDK suggestion, my final manifest file have the "wanted" minimum and target SDK :


    However, you said that all manifest files must have the same min and target SDK, which i did for the exposed manifest files, but does this mean i have to change it for all the manifests inside the .aar files too ?? and is this mentionned anywhere in the documentation ? cause Unity IAP for example uses a minimum SDK of 9, which i don't even have installed in my SDK manager, so i really don't see a reason to follow that suggestion.

    Thanks!
     
  11. Aladine

    Aladine

    Joined:
    Jul 31, 2013
    Posts:
    195
    SOLVED
    it was Fabric Crashlytics...
     
    MD_Reptile likes this.
  12. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    Thanks for taking the time to report what helped you :D
     
    Aladine likes this.
  13. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    This might have been a misunderstanding as I did not say it like that. Different manifest files can have different min / target sdk versions. Manifest merger will take care of that.
    When I've said
    I was answering both of your questions in one sentence and that could've been not clear. So the answer to
    is "yes, it's ok to use min version set to 21 and target version set to 27". And the answer to
    is "for READ_PHONE_STATE permission issue the version numbers do not matter as long as they are higher than 3". Sorry for confusing you.
     
    Aladine likes this.
  14. mygourabunity

    mygourabunity

    Joined:
    Nov 9, 2016
    Posts:
    4
    Hi there,
    i am having trouble in one case.there is no permission given for contacts and calls.though its asking for permission for those.really frustrating..
     
  15. rahul_noob

    rahul_noob

    Joined:
    Oct 3, 2017
    Posts:
    26
    But in my case, I just put same min & max SDK version to every manifest file, And it did actually solve my problem.