Hello, I am having trouble getting my playfab login code to work. We are currently only published to Android so I only need to worry about it and not iOS login or any other platform. I had it working before with the regular systemDeviceIdentifer instead of the Android specific ID but once I switch it to the android id it stopped working. I'm using the Unity Editor extension for the playfab id. Here's my code below:
using System.Collections; using System.Collections.Generic; using UnityEngine; using PlayFab; using PlayFab.ClientModels; public class PlayFabManager : MonoBehaviour { public string PlayFabId; void Start() { if (Application.platform == RuntimePlatform.Android) { AndroidLogin (PlayFabSettings.TitleId); } else { Login (PlayFabSettings.TitleId); } DontDestroyOnLoad(this); } void Login(string titleId) { LoginWithCustomIDRequest request = new LoginWithCustomIDRequest() { TitleId = titleId, CreateAccount = true, CustomId = SystemInfo.deviceUniqueIdentifier }; PlayFabClientAPI.LoginWithCustomID(request, (result) => { PlayFabId = result.PlayFabId; Debug.Log("Got PlayFabID: " + PlayFabId); if (result.NewlyCreated) { Debug.Log("(new account)"); } else { Debug.Log("(existing account)"); } PlayFabId = result.PlayFabId; }, (error) => { Debug.Log("Error logging in player with custom ID:"); }); } void AndroidLogin(string titleId) { 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"); LoginWithAndroidDeviceIDRequest request = new LoginWithAndroidDeviceIDRequest() { TitleId = titleId, CreateAccount = true, AndroidDeviceId = android_id }; PlayFabClientAPI.LoginWithAndroidDeviceID(request, (result) => { PlayFabId = result.PlayFabId; Debug.Log("Got PlayFabID: " + PlayFabId); if (result.NewlyCreated) { Debug.Log("(new account)"); } else { Debug.Log("(existing account)"); } PlayFabId = result.PlayFabId; }, (error) => { Debug.Log("Error logging in player with custom ID:"); }); } }