Exemple #1
0
 private static void Profile(GDDeviceProfile device, Action <bool> callback)
 {
     Gamedonia.RunCoroutine(
         ProfilePushNotification(device,
                                 delegate(bool success) {
         callback(success);
     }
                                 )
         );
 }
    public static void Register(GDDeviceProfile device, Action<bool> callback = null)
    {
        string json = JsonMapper.ToJson(device);

        Gamedonia.RunCoroutine(
            GamedoniaRequest.post("/device/register",json,
                delegate (bool success, object data) {
                    if (callback!=null) callback(success);
                }
         	 )
        );
    }
    public static void Register(GDDeviceProfile device, Action <bool> callback = null)
    {
        string json = JsonMapper.ToJson(device);

        Gamedonia.RunCoroutine(
            GamedoniaRequest.post("/device/register", json,
                                  delegate(bool success, object data) {
            if (callback != null)
            {
                callback(success);
            }
        }
                                  )
            );
    }
Exemple #4
0
    private void OnGetProfile(bool success, GDDeviceProfile device)
    {
        if (success)
        {
            //label.text += "\n Register device with id => " + device.deviceId;
            //label.text += "\n Register device with platform => " + device.deviceType;
            //label.text += "\n Register device for remote notification with token => " + device.deviceToken;

            switch (device.deviceType)
            {
            case "ios":
            case "android":
                if (GamedoniaUsers.me != null)
                {
                    GamedoniaDevices.device.uid = GamedoniaUsers.me._id;
                }
                GamedoniaDevices.Register(device);
                break;
            }
        }
    }
Exemple #5
0
    private static IEnumerator ProfilePushNotification(GDDeviceProfile device, Action <bool> callback)
    {
        if (Instance.debug)
        {
            Debug.Log("[Register Notification] RegisterForRemoteNotifications");
        }

        if (!Application.isEditor)
        {
            RegisterForRemoteNotifications();

            while (GetDeviceTokenForRemoteNotifications() == null && GetErrorRemoteNotifications() == null)
            {
                yield return(null);
            }

            if (GetErrorRemoteNotifications() == null)
            {
                deviceToken = GetDeviceTokenForRemoteNotifications();

                if (Instance.debug)
                {
                    Debug.Log("[Register Notification] token:" + deviceToken);
                }
                device.deviceToken = deviceToken;
                callback(true);
            }
            else
            {
                Debug.LogWarning("[Register Notification] failed to obtain Push Device Token: " + GetErrorRemoteNotifications());
                callback(false);
            }
        }
        else
        {
            callback(true);
        }
    }
Exemple #6
0
 private static void Profile(GDDeviceProfile device, Action <bool> callback)
 {
     callback(true);
 }
 private static void Profile(GDDeviceProfile device, Action<bool> callback)
 {
     callback (true);
 }
 public void GetProfile(GDDeviceProfile device, Action <bool> callback)
 {
     ProfileEvent(device, callback);
 }
 public void GetProfile(GDDeviceProfile device, Action<bool> callback)
 {
     ProfileEvent(device, callback);
 }