BindSetKeyChainUser() публичный статический Метод

public static BindSetKeyChainUser ( string userId, string uuid ) : void
userId string
uuid string
Результат void
Пример #1
0
        public static string GetDeviceUniqueId()
        {
#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");
            return(secure.CallStatic <string>("getString", contentResolver, "android_id"));
#elif UNITY_IPHONE && !UNITY_EDITOR
            //get device id from keychain
            //if it doesn't exist save new deviceid to keychain
            var keychain     = KeyChain.BindGetKeyChainUser();
            var userKeychain = JsonUtility.FromJson <UserKeychain>(keychain);
            if (!string.IsNullOrEmpty(userKeychain.uuid))
            {
                return(userKeychain.uuid);
            }
            KeyChain.BindSetKeyChainUser("0", SystemInfo.deviceUniqueIdentifier);
            return(SystemInfo.deviceUniqueIdentifier);
#else
            return(SystemInfo.deviceUniqueIdentifier);
#endif
        }
Пример #2
0
    void OnGUI()
    {
        GUILayoutOption[] ops = new GUILayoutOption[] {};

        GUI.skin.label.fontSize    = 30;
        GUI.skin.textArea.fontSize = 30;
        GUI.skin.button.fontSize   = 30;

        if (GUILayout.Button("UUID", ops))
        {
            currentUUID = SystemInfo.deviceUniqueIdentifier;
            Debug.Log("CurrentUUID: [" + currentUUID + "]");
        }

        GUILayout.TextArea(currentUUID, ops);

        if (GUILayout.Button("Load UUID", ops))
        {
            saveUUID = KeyChain.BindGetKeyChainUser();
            Debug.Log("LoadUUID: [" + saveUUID + "]");
        }

        GUILayout.TextArea(saveUUID, ops);

        if (GUILayout.Button("Save UUID", ops))
        {
            currentUUID = SystemInfo.deviceUniqueIdentifier;
            KeyChain.BindSetKeyChainUser("0", currentUUID);
            Debug.Log("SaveUUID: [" + currentUUID + "]");
        }

        if (GUILayout.Button("Delete UUID", ops))
        {
            KeyChain.BindDeleteKeyChainUser();
        }
    }