question

Cadrick Loh avatar image
Cadrick Loh asked

Android permission GET_ACCOUNTS is necessary?

Hi, I would like to ask is GET_ACCOUNTS android permission is necessary?

Which feature of PlayFab requires that permission?

If possible I would like to remove it because in Android 6.0 it prompts user for contacts access which I think might create misunderstanding to the users.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

marcowilliamspf avatar image
marcowilliamspf answered

Hello, I have submitted a fix for this to our generator. Here you can see the change

https://github.com/PlayFab/SDKGenerator/pull/102

In order to remove this permission please use #DISABLE_UNIQUEIDENTIFIER in your build settings -->Scripting Define Symbols along with the code from the pull request.

This fix will be released next Monday on our normal release schedule.

For context, the GET_ACCOUNTS permission is now required on Android devices in order to get the unique client Device ID via the SystemInfo.deviceUniqueIdentifier in Unity. Disabling this means that we will not query for that identifier at all, allowing you to get the Device ID via other means.


2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Cadrick Loh avatar image Cadrick Loh commented ·

I can't use LoginWithCustomID if I disable GET_ACCOUNTS permission?

0 Likes 0 ·
brendan avatar image brendan Cadrick Loh commented ·

You can use LoginWithCustomId or LoginWithAndroidDeviceId without issues. Disabling that permissions simply means that SystemInfo.deviceUniqueIdentifier cannot be used.

0 Likes 0 ·
Giacomo avatar image
Giacomo answered

This is a big issue for us as well, many players denying the permission to share contacts (understandably so). Is it for sure that your Monday release will fix this. Also, if we disable the unique identifier, how can we get the Device ID "via other means"?

,

This is a major issue for us as well, with many players denying the permission. Is it for sure that you will fix this in the Monday release, and how can we get the device ID "via other means"?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

marcowilliamspf avatar image
marcowilliamspf answered

@Giacomo, @Cadrick Loh and to anyone else whom is following this thread.

I wanted to take a moment to clarify a couple of things for you..

Prior to the fix, we implemented deviceUniqueIdentifier as a means to get device information as part of our data gathering. This is not part of any login API call in the SDK - it was being used for simple data gathering. Unfortunately, a change the way Unity uses deviceUniqueIdentifer to get that information, it now triggers this permission pop-up.

Our fix removes the dependency on deviceUniqueIdentifier for Android. This solves the issue and we are now using JNI to acquire the DeviceId natively from the Java layer. Accessing this DeviceId does not trigger any special permissions.

As for Logging in with a DeviceId, you should never use deviceUniqueIdentifier with LoginWithAndroidId. Even prior to the recent Unity change, that ID was always unreliable (under certain circumstances, it falls back to various other identifiers on Android). That's why we've always advised getting the ID natively.

To do this there is a great thread about this on the Unity Answers Forum that shows a good way to natively get the Android DeviceId (this is basically the same code we use):

#if  UNITY_ANDROID && !UNITY_EDITOR

AndroidJavaClass up = new AndroidJavaClass ("com.unity3d.player.UnityPlayer"); 
AndroidJavaObject currentActivity = up.GetStatic<AndroidJavaObject> ("currentActivity");
AndroidJavaObject contentResolver = currentActivity.Call<AndroidJavaObject> ("getContentResolver");

AndroidJavaClass secure = new AndroidJavaClass ("android.provider.Settings$Secure");
string android_id = secure.CallStatic<string> ("getString", contentResolver, "android_id");


#endif

This should always be performed with the pre-processor directive #if UNITY_ANDROID && !UNITY_EDITOR.

Outside the login flow, you can use the fix above (DISABLE_UNIQUEIDENTIFIER) to disable that check in our data gathering code, or update to the new SDK we'll be posting next week.

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Cadrick Loh avatar image Cadrick Loh commented ·

So can I say that is best to use LoginWithCustomID rather than LoginWithAndroidDeviceID?

0 Likes 0 ·
brendan avatar image brendan Cadrick Loh commented ·

You can use either. The instructions Marco gave are specifically the recommended way to get the Android Device ID. Whether you use that with LoginWithAndroidDeviceID or LoginWithCustomID is entirely up to you, but the Device ID retrieved that way will indeed be the Device ID for the client.

0 Likes 0 ·
Cadrick Loh avatar image Cadrick Loh commented ·

I've updated to the latest SDK but I still seeing read phone status and identity permission needed during installation. Why ?
Do I still need to manually add this #DISABLE_UNIQUEIDENTIFIER in scripting define symbols?

0 Likes 0 ·
Cadrick Loh avatar image Cadrick Loh Cadrick Loh commented ·

Sorry my bad, cause somewhere in my codes is using deviceUniqueIdentifier...

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.