Пример #1
0
 /// <summary>
 /// Not implemented yet.
 /// </summary>
 public static void LinkDevice(PlayFab.ClientModels.LoginResult result = null)
 {
     #if UNITY_ANDROID
     LinkAndroidDeviceIDRequest request = new LinkAndroidDeviceIDRequest()
     {
         AndroidDeviceId = DBManager.GetDeviceId(),
         ForceLink       = true,
         OS            = SystemInfo.operatingSystem,
         AndroidDevice = SystemInfo.deviceModel,
     };
     PlayFabClientAPI.LinkAndroidDeviceID(request, UnlinkCustomId, OnLinkError);
     #elif UNITY_IOS
     LinkIOSDeviceIDRequest request = new LinkIOSDeviceIDRequest()
     {
         DeviceId    = DBManager.GetDeviceId(),
         ForceLink   = true,
         OS          = SystemInfo.operatingSystem,
         DeviceModel = SystemInfo.deviceModel
     };
     PlayFabClientAPI.LinkIOSDeviceID(request, UnlinkCustomId, OnLinkError);
     #else
     LinkCustomIDRequest request = new LinkCustomIDRequest()
     {
         CustomId  = DBManager.GetDeviceId(),
         ForceLink = true
     };
     PlayFabClientAPI.LinkCustomID(request, UnlinkCustomId, OnLinkError);
     #endif
 }
Пример #2
0
    /// <summary>
    /// Links a mobile device to a PlayFab account via the unique device id (A device can only be linked to one account at a time)
    /// </summary>
    public static void LinkDeviceId()
    {
        if (!GetDeviceId())
        {
            return;
        }

        UnityAction <PlayFabError> onLinkError = error =>
        {
            PF_Bridge.RaiseCallbackError("Unable to link device: " + error.ErrorMessage, PlayFabAPIMethods.LinkDeviceID, MessageDisplayStyle.error);
        };

        if (!string.IsNullOrEmpty(android_id))
        {
            Debug.Log("Linking Android");
            var request = new LinkAndroidDeviceIDRequest {
                AndroidDeviceId = android_id
            };

            PlayFabClientAPI.LinkAndroidDeviceID(request, null, error => { onLinkError(error); });
        }
        else if (!string.IsNullOrEmpty(ios_id))
        {
            Debug.Log("Linking iOS");
            var request = new LinkIOSDeviceIDRequest {
                DeviceId = ios_id
            };

            PlayFabClientAPI.LinkIOSDeviceID(request, null, error => { onLinkError(error); });
        }
    }
Пример #3
0
    public void LinkPlayFabDeviceID()
    {
        var request = new LinkAndroidDeviceIDRequest {
            AndroidDeviceId = SystemInfo.deviceUniqueIdentifier
        };

        PlayFabClientAPI.LinkAndroidDeviceID(request, OnLinkDeviceIDSuccess, OnLinkDeviceIDFailure);
    }
Пример #4
0
    private void LinkAndroidID()
    {
        LinkAndroidDeviceIDRequest request = new LinkAndroidDeviceIDRequest();

        request.AndroidDeviceId = SystemInfo.deviceUniqueIdentifier;

        PlayFabClientAPI.LinkAndroidDeviceID(request, AndroidLinked, OnPlayFabError);
    }
Пример #5
0
 void LinkMobileID()
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         var linkIOSRequest = new LinkIOSDeviceIDRequest {
             DeviceId = GetMobileID()
         };
         PlayFabClientAPI.LinkIOSDeviceID(linkIOSRequest, result =>
         {
             CloseSignInScreen();
             EndLogin();
             Debug.Log("Linked Mobile ID");
         }, failed =>
         {
             CloseSignInScreen();
             EndLogin();
             Debug.Log("failed to link Mobile ID");
         });
     }
     else if (Application.platform == RuntimePlatform.Android)
     {
         var linkAndroidRequest = new LinkAndroidDeviceIDRequest {
             AndroidDeviceId = GetMobileID()
         };
         PlayFabClientAPI.LinkAndroidDeviceID(linkAndroidRequest, result =>
         {
             CloseSignInScreen();
             EndLogin();
             Debug.Log("Linked Mobile ID");
         }, failed =>
         {
             CloseSignInScreen();
             EndLogin();
             Debug.Log("failed to link Mobile ID");
         });
     }
     else
     {
         var linkIOSRequest = new LinkIOSDeviceIDRequest {
             DeviceId = GetMobileID()
         };
         PlayFabClientAPI.LinkIOSDeviceID(linkIOSRequest, result =>
         {
             CloseSignInScreen();
             EndLogin();
             Debug.Log("Linked Mobile ID");
         }, failed =>
         {
             CloseSignInScreen();
             EndLogin();
             Debug.Log("failed to link Mobile ID");
         });
     }
 }
Пример #6
0
        public void LinkDeviceToAccount(Callback <bool> i_requestCallback)
        {
            StartRequest("Linking device to account");

#if UNITY_EDITOR
            LinkCustomIDRequest request = new LinkCustomIDRequest()
            {
                CustomId  = SystemInfo.deviceUniqueIdentifier,
                ForceLink = true
            };

            PlayFabClientAPI.LinkCustomID(request,
                                          (result) => {
                RequestComplete("LinkDeviceToAccount() compete, success", LogTypes.Info);
                i_requestCallback(true);
            },
                                          (error) => {
                HandleError(error, "LinkDeviceToAccount() complete, error");
                i_requestCallback(false);
            });
#elif UNITY_ANDROID
            LinkAndroidDeviceIDRequest request = new LinkAndroidDeviceIDRequest()
            {
                AndroidDeviceId = SystemInfo.deviceUniqueIdentifier,
                ForceLink       = true
            };

            PlayFabClientAPI.LinkAndroidDeviceID(request,
                                                 (result) => {
                RequestComplete("LinkDeviceToAccount() compete, success", LogTypes.Info);
                i_requestCallback(true);
            },
                                                 (error) => {
                HandleError(error, "LinkDeviceToAccount() complete, error");
                i_requestCallback(false);
            });
#elif UNITY_IOS
            LinkIOSDeviceIDRequest request = new LinkIOSDeviceIDRequest()
            {
                DeviceId  = SystemInfo.deviceUniqueIdentifier,
                ForceLink = true
            };

            PlayFabClientAPI.LinkIOSDeviceID(request,
                                             (result) => {
                RequestComplete("LinkDeviceToAccount() compete, success", LogTypes.Info);
                i_requestCallback(true);
            },
                                             (error) => {
                HandleError(error, "LinkDeviceToAccount() complete, error");
                i_requestCallback(false);
            });
#endif
        }
Пример #7
0
    private void LinkDevice()
    {
#if UNITY_ANDROID
        var requestAndroidLink = new LinkAndroidDeviceIDRequest {
            AndroidDeviceId = ReturnMobileID(), ForceLink = true
        };
        PlayFabClientAPI.LinkAndroidDeviceID(requestAndroidLink, OnAndroidLinkSuccess, OnAndroidLinkFailure);
#endif

#if UNITY_IOS
        var requestIOSLink = new LinkIOSDeviceIDRequest {
            DeviceId = ReturnMobileID(), ForceLink = true
        };
        PlayFabClientAPI.LinkIOSDeviceID(requestIOSLink, OnIOSLinkSuccess, OnIOSLinkFailure);
#endif
    }
Пример #8
0
 public void LinkAndroidDevice()
 {
     if (PlayerPrefs.HasKey(DeviceLinkedFlag) == false)
     {
         LinkAndroidDeviceIDRequest LinkRequest = new LinkAndroidDeviceIDRequest()
         {
             AndroidDeviceId = SystemInfo.deviceUniqueIdentifier,
             AndroidDevice   = SystemInfo.deviceName,
             OS        = "Android",
             ForceLink = true
         };
         PlayFabClientAPI.LinkAndroidDeviceID(LinkRequest,
                                              OnLinkDeviceSuccess,
                                              (error) =>
         {
             Debug.LogError("Got error Linking Android Device ID");
             Debug.LogError(error.GenerateErrorReport());
         });
     }
 }
    /// <summary>
    /// Links a mobile device to a PlayFab account via the unique device id (A device can only be linked to one account at a time)
    /// </summary>
    public static void LinkDeviceId()
    {
        if (GetDeviceId())
        {
            PlayFabLoginCalls.RequestSpinner();
            if (!string.IsNullOrEmpty(android_id))
            {
                Debug.Log("Linking Android");
                LinkAndroidDeviceIDRequest request = new LinkAndroidDeviceIDRequest();
                request.AndroidDeviceId = android_id;

                PlayFabClientAPI.LinkAndroidDeviceID(request, OnLinkAndroidDeviceIdSuccess, OnPlayFabCallbackError);
            }
            else if (!string.IsNullOrEmpty(ios_id))
            {
                Debug.Log("Linking iOS");
                LinkIOSDeviceIDRequest request = new LinkIOSDeviceIDRequest();
                request.DeviceId = ios_id;

                PlayFabClientAPI.LinkIOSDeviceID(request, OnLinkIosDeviceIdSuccess, OnPlayFabCallbackError);
            }
        }
    }
Пример #10
0
 void LinkMobileID()
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         var linkIOSRequest = new LinkIOSDeviceIDRequest {
             DeviceId = GetMobileID()
         };
         PlayFabClientAPI.LinkIOSDeviceID(linkIOSRequest, result =>
         {
             EndLogin();
             Debug.Log("Linked Mobile ID");
         }, failed =>
         {
             switch (failed.Error)
             {
             default:
                 EndLogin();
                 break;
             }
             Debug.Log("failed to link Mobile ID");
         });
     }
     else if (Application.platform == RuntimePlatform.Android)
     {
         var linkAndroidRequest = new LinkAndroidDeviceIDRequest {
             AndroidDeviceId = GetMobileID()
         };
         PlayFabClientAPI.LinkAndroidDeviceID(linkAndroidRequest, result =>
         {
             EndLogin();
             Debug.Log("Linked Mobile ID");
         }, failed =>
         {
             switch (failed.Error)
             {
             default:
                 EndLogin();
                 break;
             }
             Debug.Log("failed to link Mobile ID");
         });
     }
     else
     {
         var linkIOSRequest = new LinkIOSDeviceIDRequest {
             DeviceId = GetMobileID()
         };
         PlayFabClientAPI.LinkIOSDeviceID(linkIOSRequest, result =>
         {
             EndLogin();
             Debug.Log("Linked Mobile ID");
         }, failed =>
         {
             switch (failed.Error)
             {
             default:
                 EndLogin();
                 break;
             }
             Debug.Log("failed to link Mobile ID");
         });
     }
 }