private static void Profile(GDDeviceProfile device, Action <bool> callback)
 {
     GamedoniaBackend.RunCoroutine(
         ProfilePushNotification(device,
                                 delegate(bool success) {
         callback(success);
     }
                                 )
         );
 }
Esempio n. 2
0
        public static void Register(GDDeviceProfile device, Action <bool> callback = null)
        {
            string json = JsonMapper.ToJson(device);

            GamedoniaBackend.RunCoroutine(
                GamedoniaRequest.post("/device/register", json,
                                      delegate(bool success, object data) {
                if (callback != null)
                {
                    callback(success);
                }
            }
                                      )
                );
        }
        private void OnGetProfile(bool success, GDDeviceProfile device)
        {
            if (success)
            {
                Debug.Log("OnGetProfile deviceType: " + device.deviceType);
                //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;
                }
            }
        }
        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);
            }
        }
Esempio n. 5
0
 private static void Profile(GDDeviceProfile device, Action <bool> callback)
 {
     callback(true);
 }
Esempio n. 6
0
 public void GetProfile(GDDeviceProfile device, Action<bool> callback)
 {
     ProfileEvent (device, callback);
 }
Esempio n. 7
0
        public static void Register(GDDeviceProfile device, Action<bool> callback = null)
        {
            string json = JsonMapper.ToJson (device);

                        GamedoniaBackend.RunCoroutine (
                                GamedoniaRequest.post ("/device/register", json,
                                        delegate (bool success, object data) {
                                                if (callback != null)
                                                        callback (success);
                                        }
                                )
                        );
        }
Esempio n. 8
0
 public void GetProfile(GDDeviceProfile device, Action <bool> callback)
 {
     ProfileEvent(device, callback);
 }
 private static void Profile(GDDeviceProfile device, Action<bool> callback)
 {
     callback (true);
 }