Search Unity

Unity 5.1 adds android permission READ_PHONE_STATE automatically, how to remove it?

Discussion in 'Android' started by mark71, Jun 14, 2015.

  1. mark71

    mark71

    Joined:
    Jun 14, 2015
    Posts:
    41
    I don't want the android READ_PHONE_STATE (= read phone state and indentity) to be added to the app permissions.
    This permission leads to bad ratings and questions! Especially for child directed apps.

    Please give us control over the permissions that are added, in 5.0 you added INTERNET and now this. I could understand the INTERNET permission, but how can I explain this permissions to the users?
    Who wants to spy on my users?

    If it is for Unity Analytics, I am not using it so there is no need to add the permission.

    I hope that it is a bug as it is not mentioned in the Unity 5.1 release notes.

    Please let me know how to remove the READ_PHONE_STATE permission.

    Thanks
     
  2. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    804
    The phone state most probably tells your game that it should pause if it runs in background
     
  3. mark71

    mark71

    Joined:
    Jun 14, 2015
    Posts:
    41
    That is possible but then I am curious why previous versions of Unity did not need the permission to pause the game.
    I hope that Unity will give an explanation because I will have to update the privacy policy.
     
  4. Xyxn

    Xyxn

    Joined:
    Apr 14, 2015
    Posts:
    1
    I have the same issue.i disabled unity analytics and build my game again, but READ_PHONE_STATE still added.

    Dear Unity, i hope it's a bug because small or one man developer, as i am, do get bad reputation because of this
     
    Last edited: Jun 16, 2015
    Frieder_Mueller and ErayT like this.
  5. parhipov

    parhipov

    Joined:
    Apr 27, 2015
    Posts:
    1
    yes Unity, could you provide us a way to disable this feature ?
     
  6. jorjon

    jorjon

    Joined:
    Jun 16, 2015
    Posts:
    1
  7. mark71

    mark71

    Joined:
    Jun 14, 2015
    Posts:
    41
    Jorjon, thanks for sharing the bug ticket.

    I have posted here and in the 'Answers' section and now there is a bug report.
    Only Unity can answer this question, are there other ways to contact them?
     
  8. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    I dont think this is the only permission we should be questioning.
    Multiple Unity games seem to force certain Android permissions that are not needed, I got emails from customers also worried to what the reason is for these permissions considering the dodgyness of the Android platform, by this I mean full of crap, so people are more caucious what they download!
    I use 3rd party asset from now to manage permissions as Unity never given a answer on this after many requests over time.
     
  9. mark71

    mark71

    Joined:
    Jun 14, 2015
    Posts:
    41
    MrEsquire, which 3rd party asset are you using to manage the permissions?
    In another thread someone from Unity warned that removing permissions could cause random crashes. Have you experienced crashes with Unity 5.1 after removing the READ_PHONE_STATE permission?

    One of my apps that is child directed has been downloaded over 300.000 times. I will be answering questions all day when I update it with a build made with Unity 5.1.

    I wonder why there are only a few replies to this thread, it is a real issue that we are losing control over the permissions and not even know what they are being used for (what information is collected?), we are responsible for what we publish.
    I still hope that it is a bug.
     
    Last edited: Jun 18, 2015
  10. mark71

    mark71

    Joined:
    Jun 14, 2015
    Posts:
    41
  11. PhoenixTalon

    PhoenixTalon

    Joined:
    Aug 26, 2012
    Posts:
    13
    I am posting this because Unity support is asking me to. However, if anyone else has an answer, I would appreciate input.

    I just upgraded Unity 5 from 5.0.2 to 5.1.1. Now my Android app is requiring the following permissions: "read phone status and identity" and "full network access view network connections". Prior to updating, these permissions were not required. Nothing has changed in the app project. No additional code was written. These new permissions are unacceptable. Please, I require a means of eliminating these permissions from the app.
     
  12. Aurore

    Aurore

    Head of Learn Content Production Unity Technologies

    Joined:
    Aug 1, 2012
    Posts:
    3,104
  13. PhoenixTalon

    PhoenixTalon

    Joined:
    Aug 26, 2012
    Posts:
    13
    I checked "The Answer" post, and it does not contain a solution. Still waiting for an answer to this issue.
     
  14. Taz-dragon

    Taz-dragon

    Joined:
    May 21, 2015
    Posts:
    38
    Could you not theoretically remove it from the manifest?
     
  15. DanielQuick

    DanielQuick

    Joined:
    Dec 31, 2010
    Posts:
    3,137
    From the Answers post:
    So yes! Yes you can.
     
  16. Taz-dragon

    Taz-dragon

    Joined:
    May 21, 2015
    Posts:
    38
    Oh yeah I forgot about that. :D
     
  17. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Any news from Unity on this issue, not seen any changes in the change logs for patch releases?
     
  18. mark71

    mark71

    Joined:
    Jun 14, 2015
    Posts:
    41
    No news, still waiting...
    As you said there have been several releases and patch builds and I wonder when it will be fixed. I haven't seen any Android specific fixes in the latest release and patch builds and the bug is still 'open'. With a major release like Unity 5 I would expect Unity to fix the bugs and work towards something stable before implementing and adding new features so that developers can release their apps. There still seem to be many problems with Android.
     
    MrEsquire likes this.
  19. Jack-Unity

    Jack-Unity

    Unity Technologies

    Joined:
    May 21, 2013
    Posts:
    34
    Hi, we're aware of this issue and looking in to it. I will report back when there is more information on this.
     
    mark71, sandbaydev and MrEsquire like this.
  20. sandbaydev

    sandbaydev

    Joined:
    Aug 9, 2013
    Posts:
    68
  21. mdrotar

    mdrotar

    Joined:
    Aug 26, 2013
    Posts:
    377
    mark71 and MrEsquire like this.
  22. mark71

    mark71

    Joined:
    Jun 14, 2015
    Posts:
    41
  23. mdrotar

    mdrotar

    Joined:
    Aug 26, 2013
    Posts:
    377
    Could they not have added a comment as to why it was closed with "Won't Fix"? Are they really not going to fix it? Shouldn't it be marked "Duplicate" if there is another bug dealing with it?
     
  24. mark71

    mark71

    Joined:
    Jun 14, 2015
    Posts:
    41
    I hope that closing the bug was a mistake as this is a nasty permission. Some developers say it is unacceptable.
    @Unity you say that you 'democratise game development', then please listen to the worries of your users and remove this permission as it kills their business.

    If it was not a mistake then they should:
    1. explain why they won't fix it.
    2. explain why Unity needs it even if the developer does not need it and doesn't want it.
    3. describe in detail what it is used for and update their privacy policy so that developers can update their privacy policy and refer to it.
    We are responsible for what we publish, we have to comply with the laws of the countries where we publish, e.g. COPPA.
     
    mh114 and MrEsquire like this.
  25. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,050
    The Android build enforces READ_PHONE_STATE if the code has references to SystemInfo.deviceUniqueIdentifier.
    INTERNET is added when any network classes are referenced.
    ACCESS_NETWORK_STATE is added when calling Application.internetReachability.

    There is no bug in Android code, just the new services dlls are calling different API enforcing these "unnecessary" permissions. There might be an issue with the services' dlls though.

    In addition, there is always a workaround - you can export the project, modify it as you wish and build in Eclipse/Android Studio.

    Of course the code won't crash if the permission is missing. Just some functionality may be unavailable.

    Can I please have the list of "many problems with Android"? Thank you!
     
    MrEsquire likes this.
  26. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Thanks for the solid explanation finally we maybe able to rest this one.

    I think what he means by many problems and I let him speak,
    but my list would be
    - Black Screen on some Android devices
    - Performance issues / FPS drops
    But please note this is specific to Unity 5 only.

    We are also conducting tests on Unity 5.2 beta to see if any changes, although there is performance improvements, they not at the point of 4.6. There is a long thread about this on the Android forums. Also in terms the black screen I know you cannot reach out to the thousands of Android devices out there, but I think its based on the chipsets.

    So you need to understand peoples frustration all of a sudden...but to be honest Android is the most corrupt market place and hard to weed out the real issues..
     
  27. mdrotar

    mdrotar

    Joined:
    Aug 26, 2013
    Posts:
    377
    Could this be added to the script reference docs?

    Why was the bug marked as "Won't Fix"? I can't see this not getting fixed. Whether it's a bug for the android team or a bug for one of the services teams, it doesn't matter to us. It just needs to get fixed as soon as possible.
     
    ABCptt likes this.
  28. mark71

    mark71

    Joined:
    Jun 14, 2015
    Posts:
    41
    Thanks for your explanation.

    To us (developers) Unity is a black box and we cannot see where the permissions are added.
    A project with an empty scene had the permission.

    You say that there might be an issue with the services' dlls.
    Do you mean that the READ_PHONE_STATE permission is not enforced intentionally and that it shouldn't be there when no additional services (like Ads and Analytics) are used?

    I read about the workaround but when I build my app the automatic build process generates 28 different apps. I cannot do that by hand.

    In addition to the problems listed by MrEsquire I had a weird text rendering problem all characters were rendered as blocks. I have seen it several times but I have not been able to reproduce it. Someone else describes the issue here:
    http://forum.unity3d.com/threads/text-rendering-as-blocks-briefly-bug-in-ios-build.330301/
     
  29. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,050
    This is correct. None of the Android permission management code has changed during recent versions so far. It works late in the build process, analyzing managed DLLs and build configuration.

    Today I asked our lead QA to take a closer look at the bug report # 705138 (which is basically the same as the one closed as "won't fix"). We will try to find a solution here.
     
    mdrotar likes this.
  30. mark71

    mark71

    Joined:
    Jun 14, 2015
    Posts:
    41
    Thank you very much Yury.
     
  31. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    274
    I'd hazard a guess that it's Unity Analytics that accesses the device identifier, forcing this permission. IMHO analytics should never use the device ID, unless explicitly requested by the (API) user, so hopefully you guys sort this out and remove the device ID usage, or at least make it optional.

    Speaking from experience, I can tell that many users are very paranoid about this READ_PHONE_STATE -permission; "why does your game want to access my phone calls!??"...
     
    ABCptt likes this.
  32. sschan

    sschan

    Unity Technologies

    Joined:
    Oct 8, 2014
    Posts:
    87
    Hi all -
    As Yury Habets mentioned in the earlier post the workaround he suggested is a solution to the issue currently.
    Also the READ_PHONE_STATE permission is in the process of being resolved for 5.2 release. Finally Unity Analytics only collects anonymized user ID. Please read below on what this entails:

    1. What information does Unity Analytics collect?

    In order to provide analytics for your games, Unity Analytics collects and uses in each game built with Unity Editor an anonymized user ID. Each ID is unique to users on each developer’s apps. These IDs cannot be used to track users across apps built by other developers and cannot be mapped between different services, devices, or even different browsers on the same computer. For further information, please review the Unity Privacy Policy: https://unity3d.com/legal/privacy-policy.

    2. What is the anonymized user ID used for?
    The anonymized user ID is used to track the activities of game players in order to help developers: (i) provide game usage and performance analytics; (ii) understand game performance and monitor game health and areas of crashing; (iii) improve game design and green lighting; (iv) deploy future game development resources based on game performance; (v) maintain or analyze the functioning of games, including through maintenance, analysis and analytics; (vi) protect the security and integrity of game players; (vii) serve contextual advertising and cap the frequency of advertising; and (viii) ensure legal or regulatory compliance.
     
  33. mdrotar

    mdrotar

    Joined:
    Aug 26, 2013
    Posts:
    377
    Are the INTERNET and ACCESS_NETWORK_STATE permissions going to be fixed as well in 5.2?
     
  34. mark71

    mark71

    Joined:
    Jun 14, 2015
    Posts:
    41
    I think that the INTERNET permission is intentional and used by Unity to obtain device information to improve Unity and for statistics. Earlier versions had a setting to opt out but it was removed.
     
  35. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,050
    INTERNET permission is highly unlikely to be removed.
     
  36. PhoenixTalon

    PhoenixTalon

    Joined:
    Aug 26, 2012
    Posts:
    13
    I'm not sure why Unity would force us, as developers, to include permissions we do not want. This will hurt our marketability. Maybe a detailed explanation of why Unity wants to use our apps to gather this information would help ease the bitter taste. In my humble and often ignored opinion, permissions should be added solely by the developer and not by the engine designer. Following this line of thinking, promotes trust along the whole development chain. From engine developer, to app developer, to end user. If my user doesn't trust me, then how can I trust my engine maker? It begs the question, are there any other hidden lines of code waiting to surface? Just an opinion.
     
  37. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,050
    We don't force permissions, we just set it with accordance to what APIs you call or which build settings you have selected.

    INTERNET permission is required by networking and analytics modules, IIRC. If they can be excluded - then the permissions will not be forced.

    The upcoming Android M release is supposed to add more granular control over the permissions.
     
  38. PhoenixTalon

    PhoenixTalon

    Joined:
    Aug 26, 2012
    Posts:
    13
    I refer to my original post which states:

    Prior to updating, these permissions were not required. Nothing has changed in the app project. No additional code was written.

    I didn't add anything, so why do I have these permission requirements. I just want them gone. Please tell me what I need to do.
     
  39. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,050
    As you may have read -

    Nothing has changed as well in the Unity Android code with regard to permissions. Sounds like a deadlock? :)

    I have also written that you can try exporting project from Unity, opening it in Android Studio, modifying the manifest and building it.
     
  40. jathrek

    jathrek

    Joined:
    Jul 16, 2015
    Posts:
    36
    Hello,

    I'm quite a new to Unity, so I may not be aware of all the details about the parts of the API I'm using, but I'm in a similar situation as PhoenixTalon; my application required no permissions when building 5.0, but does now (since 5.1.something).

    To be clear, the last version I deployed a few weeks ago, built with 5.0, required no permissions at all.

    But, after some weeks of not working on it (I had to cope with some belgian fiscal obligations, which might trigger sympathy from anyone knowing about Belgium ;-p), coming back recently to install the updates to 5.1.something and making only (relatively) minor changes (mostly using more functionalities of Unity 5's UI and PlayerPrefs), I now get the these permission requests added in the final APK; READ_PHONE_STATE (as discussed before, which should be fixed soon), INTERNET and ACCESS_NETWORK_STATE (also as discussed before).

    The thing is, I've no knowledge of adding anything network-related and I've no idea of what I could remove to have these two latter permissions removed (I like to have my Android applications permissions-free ;-).

    Would anyone have any tips on that?
    Should I look for classes with specific names or being found in specific packages?

    [Edit]
    After a bit of (better) reading, I understood that the Internet access might be required due to Unity Analytics, which can only be disabled on the pro version of Unity. Is that correct?

    Thank you!
     
    Last edited: Jul 16, 2015
  41. sschan

    sschan

    Unity Technologies

    Joined:
    Oct 8, 2014
    Posts:
    87
    Hi folks - I'm on the Unity Analytics team and can only speak how these permissions relate to analytics. Internet access is related to hardware stats collection. Hardware stats is automatically enabled in the Personal Edition of Unity. Pro users have the ability to disable hardware stats. However in 5.1 it must be enabled for analytics to work. For those who want to disable hardware stats but still use analytics, you can either use our SDK integration (Unity 4.x-5.0), or wait until 5.2 when the hardware stats player setting will be de-coupled from analytics functionality
     
    sandbaydev likes this.
  42. jathrek

    jathrek

    Joined:
    Jul 16, 2015
    Posts:
    36
    Hello, sschan,

    Just another quick question;
    In 5.2, when - as you say - the Hardware Stats Collection is decoupled from Unity Analytics, will we have a finer control on what is enabled or not? Will the difference between free and pro version remain?

    Although I'm planning to buy the pro version anytime soon and mandatory Unity Analytics would not be a "long term issue", I do believe that forcing games built with the free version to require Internet access (or at least the permission, which can already give a "bad" image, at least on the Google Play Store) is not very nice? Although I can understand that, probably, not a lot of people using the pro version activates Analytics on their Android version of their game (for this same I-don-t-want-to-require-Internet-access reason) and you might indeed need such statistics to keep making a correct product.

    I personnally taught that the restriction to 100k annual revenue (or even a lower amount) was a nice and flexible incentive to switch to the pro version, but this new particularity seems more like a much-less-nice incentive to force people to do the switch (like, taking a decision for the bad reason)...

    [Edit]
    Anyway, I suppose the decision took you quite a long time to be taken and that you're aware of both advantages and inconvenients of the solution, so you can take the freedom to ignore my last 2 paragraphs and I won't complain about it. ;-)


    Best regards.
     
    Last edited: Jul 17, 2015
  43. sschan

    sschan

    Unity Technologies

    Joined:
    Oct 8, 2014
    Posts:
    87
    Hi @jathrek - To clarify, Unity Analytics is an optional service and not "mandatory" either in the Personal or Pro Edition. To enable analytics you must create a dashboard account and follow integration instructions on analytics.unity3d.com. :)
     
  44. jathrek

    jathrek

    Joined:
    Jul 16, 2015
    Posts:
    36
    Erh, OK...

    The thing is, I never did anything to add Unity Analytics and I actually never even knew about this functionality before encountering this new permission requests from my game (and reading these posts).

    I'll try to find out where I could have activated it (by mistake) in my project and disable it.


    Thank you.
     
  45. PhoenixTalon

    PhoenixTalon

    Joined:
    Aug 26, 2012
    Posts:
    13
    Ok so I finally got all the permissions to go away, but not through Unity. unfortunately I had to go and figure out how to use Android Studio https://developer.android.com/sdk/index.html, and learn how to adjust the manifest, as suggested earlier. Took an entire morning to learn and adjust. What a pain! I've never been a big fan of exporting from one place to another, especially to fix a bug which didn't exist before, but c'est la vie. For anyone interested, I followed a video I found on YouTube to help with generating the signed apk
    . Thank goodness for YouTube! Deleting the necessary permissions from the xml manifest was easy, but you may throw an error when you build. There's a setting that you may have to delete because it sets a default state, which Android Studio doesn't like for some reason. Maybe when I get a break from development, I'll make a complete video myself and post it here (or maybe someone else will). Game runs great now, with no permissions of any kind, and I'm one step closer to release!

    On a side note: I love the Unity game engine, but I am not happy at all with this situation. Mixed feelings are mixed.
     
    sampenguin, aer0ace and sandbaydev like this.
  46. sandbaydev

    sandbaydev

    Joined:
    Aug 9, 2013
    Posts:
    68
    My game has no permissions when I compile it using 5.0.3f2.

    When I compile it using 5.1.0f3, it requires permissions
    - android.permission.INTERNET
    - android.permission.READ_PHONE_STATE
    - android.permission.ACCESS_NETWORK_STATE

    I'm opening the same project so I'm using exactly the same source code. The change must be something to do with 5.0 versus 5.1.

    I'm wondering a bit about that "nothing has changed" answer, when it's clear that there's something has changed between v5.0 and v5.1 that causes issues with the Android permissions.

    My question: Are all these three permissions due the Unity Analytics?
    Can @Yury Habets and @sschan confirm that this problem won't exist in 5.2? (If I toggle off Analytics in v5.2?). I'm using the Unity free version. Thank you.
     
  47. PhoenixTalon

    PhoenixTalon

    Joined:
    Aug 26, 2012
    Posts:
    13
    It is obvious to me (and many others) something has changed, and either Unity is lying about it (I hope not), or one side of the table is not talking to the other (more likely).

    No matter the case, Unity does not seem interested in finding the root of the issue, nor do they seem intent on fixing it. They seem to be content to deny the problem exists, and let their customers solve the problem with third party workarounds.

    If Unity wasn't such a good game engine, I might change because of this level of "support". This does seem to be a typical first response to bugs for all the years I've used it.

    If(problem == true){fix = null; problem = false;}

    I do have faith it will eventually be fixed, but it might take 6 months or more. Oh and they have to admit the problem is there.
     
    ABCptt and MrEsquire like this.
  48. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Sorry to be negative, just seems Unity does not seem to know what is going on!!

    Can someone provide a clear answer as sandbaydev has asked.

    Right now all I see from Unity is confused answers and pass the parcel
     
    Prodigga and PhoenixTalon like this.
  49. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,050
    Please don't distort my words.
    I said nothing changed in Android code with regard to permission management. It is working correctly at the moment, as far as I am concerned.

    Millions of other things did change! We shipped GLES 3.1 + AEP support! And many other brilliant features.

    Among these features are the new services, which unfortunately require more permissions. They could probably be missing the option to disable/exclude from build, which will fix everything for you.

    In 5.2, Analytics is using different approach, so phone state is no longer required. (more info to come from the Analytics team).
     
    sandbaydev likes this.
  50. mdrotar

    mdrotar

    Joined:
    Aug 26, 2013
    Posts:
    377
    I'm having a hard time understanding why INTERNET and ACCESS_NETWORK_STATE are still planned to be forced on. If we can remove them by exporting to Android Studio and manually removing them and everything still works (aside from analytics and anything else requiring internet, of course), then why not allow us to control that within Unity? While those 2 permissions are not a big deal for the projects I'm working on right now, they could be show stoppers for some projects. The workaround breaks too much of the workflow to be a permanent solution.

    I get that on the services side it's "analytics uses internet" and on the Android side it's blindly processing "code detected that needs permission" and QA says "it's not a bug because it's intended behaviour on both sides"... so, who takes ownership of these types of issues? Anyone?