블로그 이미지
Every unexpected event is a path to learning for you.

카테고리

분류 전체보기 (2324)
Unity3D (568)
Programming (472)
Unreal (4)
Gamebryo (56)
Tip & Tech (185)
협업 (34)
3DS Max (3)
Game (12)
Utility (116)
Etc (92)
Link (31)
Portfolio (19)
Subject (90)
iOS,OSX (38)
Android (13)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (1)
Memories (19)
Interest (37)
Thinking (36)
한글 (26)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (19)
Exercise (3)
나만의 맛집 (2)
냥이 (9)
육아 (9)
Total1,344,773
Today198
Yesterday150
Statistics Graph

달력

« » 2019.12
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

공지사항

태그목록

[Link] https://jinreo.tistory.com/12

 

Unity 에서 Android Permission 삭제 관련

- READ_PHONE_STATE 한글로 보면 전화걸기 뭐 이런 식으로 설명하고 해당 권한을 받는다. (make and manage phone call) 유니티상에서 SystemInfo.deviceUniqueIdentifier를 사용하면 자동으로 추가되는데 해당 코..

jinreo.tistory.com

 

Posted by blueasa

댓글을 달아 주세요

READ_PHONE_STATE Permission isn’t in my Manifest or Plugins!

Unity automatically adds the READ_PHONE_STATE permission into builds when either:

  • Your scripts contain code which require the permission.
  • The target SDK version isn’t set (or set below 4) which causes the manifest merger to assume the SDK version is lower than 4 and the system will implicitly grant the READ_PHONE_STATE permission to the app. (in later versions of Unity 5 and Unity 2017 the target SDK version is now set in the editor making managing it much easier)
  • You have a plugin in your project which has its own manifest file requesting the permission (the manifest can be contained within your jar or aar files, they’re not always simply in your project) – Note that if a plugin is requesting a permission then it’s probably required and may cause issues if removed, check the plugin documentation if you’re unsure!

Code which causes Unity to automatically add the permission

In the case of your scripts containing code which need the permission. Unity automatically adds the permission when using functions which require it.

Some SystemInfo properties such as SystemInfo.deviceUniqueIdentifier require the READ_PHONE_STATE permission so referencing it in a script will force Unity to add it.

As an alternative to SystemInfo.deviceUniqueIdentifier when needing a unique device identifier and it’s not important to keep it the same between wiping save data. Consider generating a unique value based on System.DateTime.Now.Ticks and storing in the playerprefs instead.



Why am I asked to allow/deny the permission at app launch?

Starting with Android 6.0 the user was given more control over permissions apps were allowed to use at runtime; rather than a blanket list of confusing permission being included with the app at installation. Permissions which are prompted for the user to allow are classified as dangerous permissions as they can allow the app to access sensitive data. (in this case READ_PHONE_STATE can allow reading of the phone number, call statuses or list phone accounts registered on the device)

If you want to manually control when the permissions are requested at runtime rather than all dangerous permissions just being prompted at startup then you can add:
<meta-data android:name=”unityplayer.SkipPermissionsDialog” android:value=”true” />
Between the <application> tags of your manifest file.

With the permission dialog skipped all dangerous permissions will remain defaulted as denied! But this allows you to request permissions manually when you need them, rather than all at once at app launch. (However note that you’ll either need to write a Java plugin yourself to control this or find an already built plugin from the store such as Android Buddy which fits this exact purpose!)

Learn more about the READ_PHONE_STATE android permission!

You can read more about the READ_PHONE_STATE permission on the android developer site at https://developer.android.com/reference/android/Manifest.permission.html#READ_PHONE_STATE

 

[출처]

https://www.unity3dtips.com/read_phone_state-permission-android/

 

Remove READ_PHONE_STATE Permission Unity Android - Unity3d Tips

How to remove the READ_PHONE_STATE permission in your Unity Android apps and find the cause! Alternatively prompt the permission later than app startup!

www.unity3dtips.com

 

Posted by blueasa

댓글을 달아 주세요

[추가]

Unity v5.6.7, Android SDK 최신 버전에서 READ_PHONE_STATE 권한을 제거 했는데도 계속 추가되는 문제가 있어서 알아본 결과 Android SDK 최신 버전에서 필요하다고 판단되면 READ_PHONE_STATE를 강제로 추가하고 있다.

(Unity 최신버전(현재 Unity 2018이상 버전)에서는 해당 버그가 수정된 듯 하다.)

 

내 경우는 SystemInfo.deviceUniqueIdentifier를 사용하게 되면서 필요하다고 판단해서 READ_PHONE_STATE를 추가시키고 있었다.

 

아래 설명대로 Android SDK 25.2.5 버전에서는 강제로 추가하는 문제가 없어서 SDK 버전을 되돌렸는데

Manifest Merge 관련 문제가 많이 나와서(최신 Android SDK에서는 자동 정리해주는 중복 Manifest 관련 문제를 25.2.5에서는 자동으로 해결해주지 못해서 직접 수정함) 문제되는 aar 파일 안의 AndroidManifest 파일을 모두 수정해서 해결 했다.

한 10개정도 수정한 듯..

 

-------------------------------------------------

 

Steps to reproduce:

1) Update SDK to the latest version (26.0.2) 
2) Download attached project 'Repo.zip' and open in Unity 
3) Build .apk file 
4) Open 'AndroidManifest.xml' file (Temp/StagingArea/AndroidManifest.xml)

Expected result:READ_PHONE_STATE permission should not be added in the AndroidManifest.xml (check attachment 'AndroidManifest_created_with_26.0.2.xml') 
Actual result: READ_PHONE_STATE permission is added in the AndroidManifest.xml (check attachment 'AndroidManifest_created_with.25.2.3.xml')

Reproduced with: 
5.5.4p1, 5.6.2p1, 2017.1.0f1, 2017.2.0b1

Note: READ_PHONE_STATE permission wasn't added using 25.2.5 sdk

RESOLUTION: By design. The project includes a plugin (com.nerd.TapdaqUnityPlugin) which does not specify targetSdkVersion in its manifest. Thus android manifest merger correctly assumes that the SDK version is lower than 4 and implicitly grants the READ_PHONE_STATE permission. See https://developer.android.com/reference/android/Manifest.permission.html#READ_PHONE_STATE. The difference between 25.2.5 and 26.0.2 SDKs is that in the latter we use different manifest merger implementation which is more strict.

 

[출처]

https://issuetracker.unity3d.com/issues/android-read-phone-state-permission-is-added-in-the-androidmanifest-dot-xml-file-using-latest-26-dot-0-2-sdk

 

Unity IssueTracker - [Android] READ_PHONE_STATE permission is added in the AndroidManifest.xml file using latest (26.0.2) SDK

Steps to reproduce: 1) Update SDK to the latest version (26.0.2) 2) Download attached project 'Repo.zip' and open in Unity 3) Build ...

issuetracker.unity3d.com

 

Posted by blueasa

댓글을 달아 주세요