Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Unity 5.3.4 - disable ReadPhoneState permission when importing IAP [Android]

Discussion in 'Unity IAP' started by psvgamestudio, May 22, 2018.

  1. psvgamestudio

    psvgamestudio

    Joined:
    Jan 13, 2017
    Posts:
    12
    Since some latest Unity IAP updates, projects built under this engine version started requesting read_phone_state permission, though it is not present in any of manifests inside Assets dir. And only after disabling IAP plugin we get requestless APK. Also this permission request disappears if we upgrade our project to engine version 5.4.0.

    Is it possible to disable extra permission request in 5.3.4?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    What version of IAP are you using? You can check the changelog file for the version, located in Assets/Plugins/UnityPurchasing
     
  3. psvgamestudio

    psvgamestudio

    Joined:
    Jan 13, 2017
    Posts:
    12
    [1.18.0] - 2018-03-27
    [1.19.0] - 2018-04-17
    These versions I've been using in my projects.
     

    Attached Files:

  4. unityjingyao

    unityjingyao

    Unity Technologies

    Joined:
    Feb 20, 2017
    Posts:
    220
    Hi @psvgamestudio ,
    Which store are you targeting to?
    UnityChannel.aar has read_phone_state permission, but it should only be included when you change the IAP target to "Xiaomi Mi Game Pay".
     
  5. psvgamestudio

    psvgamestudio

    Joined:
    Jan 13, 2017
    Posts:
    12
    I'm targetting GooglePlay Only. Also Unity 5.3.4 has no option to add Xiaomi Game Center in BuildSettings, so it won't affect this case.

    UnityChannel is present in my project's Plugins folder. Will it's removal break the game?
     

    Attached Files:

  6. unityjingyao

    unityjingyao

    Unity Technologies

    Joined:
    Feb 20, 2017
    Posts:
    220
    That's weird. That permission shouldn't be included if targeting to Google Play.
    Unity IAP has Xiaomi Game Center integrated.
    Removing UnityChannel.arr should not break your game.
    Please try to remove it to see if your game still has the permission.
     
  7. psvgamestudio

    psvgamestudio

    Joined:
    Jan 13, 2017
    Posts:
    12
    I've found two aar libraries containing read_phone_state permission
    Assets/Plugins/UnityPurchasing/Bin/Android/CloudMoolah.aar
    Assets/Plugins/UnityPurchasing/Bin/Android/CloudMoolah.aar
    Though removing them from project didn'r disable permission request.

    Any ideas?
     
  8. unityjingyao

    unityjingyao

    Unity Technologies

    Joined:
    Feb 20, 2017
    Posts:
    220
    Hi @psvgamestudio ,
    Have you tried to delete the "Library" folder?
    I guess that there might be a cached AndroidManifest.xml file which still contains that permission.
     
  9. psvgamestudio

    psvgamestudio

    Joined:
    Jan 13, 2017
    Posts:
    12
    In my previous post I've pasted two times one of found libraries. Here are they, both containing read_phone_state permission:
    Assets/Plugins/UnityPurchasing/Bin/Android/CloudMoolah.aar
    Assets/Plugins/UnityChannel/Android/UnityChannel.aar

    So I've removed them completely from project. Deleted Library folder, reopened project, compiled it and got same result. App requested permission to manage phone calls. And I had to reject it twice to start the game (after first request was cancelled, another one showed up).

    PS: it started since few latest IAP versions were released (5-8). Right after routine update of IAP plugin my new APK begun requesting phone access.
     
  10. psvgamestudio

    psvgamestudio

    Joined:
    Jan 13, 2017
    Posts:
    12
    after disabling permission in this way game started without asking anything. Also it solved trouble when on Android Oreo game will not start (black screen and no Unity tagged messages in logCat). Now app launches fine.
    Though its is a temporary solution and I hope you'll find a way to disable this unwanted permission for Unity 5.3.4.
     
  11. unityjingyao

    unityjingyao

    Unity Technologies

    Joined:
    Feb 20, 2017
    Posts:
    220
    Hi @psvgamestudio ,
    Could you please send me a sample project which could reproduce this issue?
    I would like to test it on my side and try to find the cause.
    I apologize for any inconvenience this issue has caused.
     
  12. GiyomuGames

    GiyomuGames

    Joined:
    Jan 12, 2015
    Posts:
    80
    Worked for me thanks :)