Exemple #1
0
 private void HandleNotificationReceived(OSNotification result)
 {
     if (IsInForeground)
     {
         ProcessNotification(result.payload.additionalData);
     }
 }
Exemple #2
0
        //--------------------------------------------------------
        // OneSignal Event Handlers
        //--------------------------------------------------------
        #if EM_ONESIGNAL
        // Called when your app is in focus and a notification is recieved (no action taken by the user).
        private void HandleOneSignalNotificationReceived(OSNotification notification)
        {
            var delivered = OneSignalHelper.ToCrossPlatformRemoteNotification(null, notification);

            // Fire event
            RaiseRemoteNotificationEvent(delivered);
        }
Exemple #3
0
 static void handleNotificationReceived(OSNotification notification)
 {
     if (OfflinePushMessages.fetchPushMessages(true))
     {
         OneSignal.Current.ClearAndroidOneSignalNotifications();
     }
 }
        //OneSignal Notification Received Method
        private static void HandleNotificationReceived(OSNotification notification)
        {
            OSNotificationPayload payload = notification.payload;
            string message = payload.body;

            test = message;
        }
Exemple #5
0
        private async static void HandleNotification(OSNotification notification, string actionId)
        {
            var payload        = notification.payload;
            var message        = payload.body;
            var additionalData = payload.additionalData;

            Console.WriteLine(message);

            if (additionalData != null)
            {
                if (additionalData.ContainsKey(Strings.PushNotificaionKeys.nearby_broadcast))
                {
                    var transactionIdString = additionalData[Strings.PushNotificaionKeys.nearby_broadcast] as NSString;
                    if (transactionIdString == null)
                    {
                        return;
                    }

                    //increment the discover notificaion count
                    var persisantStorageService = ServiceLocator.Instance.Resolve <IPersistantStorage>();
                    persisantStorageService.IncrementDiscoverNotificaionCount(1);


                    //give time app to load
                    await System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(2));

                    GoToDiscoverPage((actionId == null));
                }
            }
        }
Exemple #6
0
        private static void HandleNotificationReceived(OSNotification notification)
        {
            Acr.UserDialogs.UserDialogs.Instance.Toast(AppResource.AlertNewNotification, TimeSpan.FromSeconds(1));
            //CrossLocalNotifications.Current.Show("title", "body");

            //App.AppCurrent.NavigationService.NavigateAsync(new NotificationPopupPage());
            //PopupNavigation.Instance.PushAsync(new NotificationPopupPage(notification));
        }
Exemple #7
0
 internal static RemoteNotification ToCrossPlatformRemoteNotification(
     string actionId, OSNotification notification)
 {
     return(new RemoteNotification(
                actionId,
                ToCrossPlatformOSNotificationPayload(notification.payload),
                notification.isAppInFocus,
                notification.shown));
 }
Exemple #8
0
    // Called when your app is in focus and a notificaiton is recieved.
    // The name of the method can be anything as long as the signature matches.
    // Method must be static or this object should be marked as DontDestroyOnLoad
    private static void HandleNotificationReceived(OSNotification notification)
    {
        OSNotificationPayload payload = notification.payload;
        string message = payload.body;

        print("GameControllerExample:HandleNotificationReceived: " + message);
        print("displayType: " + notification.displayType);
        extraMessage = "Notification received with text: " + message;
    }
        private void HnadleNonSilent(OSNotification notification)
        {
            var silentOption = GetPayloadItem(notification, IsSilentKey);

            if (silentOption == SilentOptionNonSilent)
            {
                CrossLocalNotifications.Current.Show("Notification", notification.payload.body);
            }
        }
        //--------------------------------------------------------
        // OneSignal Remote Notification Event Handlers
        //--------------------------------------------------------

        // Called when your app is in focus and a notification is recieved (no action taken by the user).
        private void HandleOneSignalNotificationReceived(OSNotification notification)
        {
            var delivered = OneSignalHelper.ToCrossPlatformRemoteNotification(null, notification);

            // Fire event
            if (RemoteNotificationOpened != null)
            {
                RemoteNotificationOpened(delivered);
            }
        }
        private void OnNotificationRecevied(OSNotification notification)
        {
            if (notification.payload?.additionalData == null)
            {
                return;
            }

            if (notification.payload.additionalData.ContainsKey("labelText"))
            {
                var labelText = notification.payload.additionalData["labelText"];
                App.Current.MainPage = new NotificationSummaryPage(labelText.ToString());
            }
        }
        private static string GetPayloadItem(OSNotification notification, string payloadItemKey)
        {
            var obj = new object();

            if (notification.payload.additionalData.TryGetValue(payloadItemKey, out obj))
            {
                return(obj.ToString());
            }
            else
            {
                return(null);
            }
        }
      static OSNotification OSNotificationToNative(Android.OSNotification notif)
      {
         var notification = new OSNotification();
         notification.shown = notif.Shown;
         notification.androidNotificationId = notif.AndroidNotificationId;
         notif.GroupedNotifications = notif.GroupedNotifications;
         notif.IsAppInFocus = notif.IsAppInFocus;
         
         notification.payload = new OSNotificationPayload();


         notification.payload.actionButtons = new List<Dictionary<string, object>>();
         if (notif.Payload.ActionButtons != null)
         {
            foreach (Android.OSNotificationPayload.ActionButton button in notif.Payload.ActionButtons)
            {
               var d = new Dictionary<string, object>();
               d.Add(button.Id, button.Text);
               notification.payload.actionButtons.Add(d);
            }
         }

         notification.payload.additionalData = new Dictionary<string, object>();
         if (notif.Payload.AdditionalData != null)
         {
            var iterator = notif.Payload.AdditionalData.Keys();
            while (iterator.HasNext)
            {
               var key = (string)iterator.Next();
               notification.payload.additionalData.Add(key, notif.Payload.AdditionalData.Get(key));
            }
         }
         
         notification.payload.body = notif.Payload.Body;
         notification.payload.launchURL = notif.Payload.LaunchURL;
         notification.payload.notificationID = notif.Payload.NotificationID;
         notification.payload.sound = notif.Payload.Sound;
         notification.payload.title = notif.Payload.Title;
         notification.payload.bigPicture = notif.Payload.BigPicture; 
         notification.payload.fromProjectNumber = notif.Payload.FromProjectNumber; 
         notification.payload.groupMessage = notif.Payload.GroupKey; 
         notification.payload.groupMessage = notif.Payload.GroupMessage; 
         notification.payload.largeIcon = notif.Payload.LargeIcon; 
         notification.payload.ledColor = notif.Payload.LedColor; 
         notification.payload.lockScreenVisibility = notif.Payload.LockScreenVisibility; 
         notification.payload.smallIcon = notif.Payload.SmallIcon; 
         notification.payload.smallIconAccentColor = notif.Payload.SmallIconAccentColor;

         return notification;
      }
        private async void OnNotificationRecevied(OSNotification notification)
        {
            if (notification.payload?.additionalData == null)
            {
                return;
            }

            if (notification.payload.additionalData.ContainsKey("body"))
            {
                var labelText = notification.payload.additionalData["body"].ToString();
                Settings.LastNotify = labelText;
                CheckNotification();
            }
        }
Exemple #15
0
        private void OnNotificationRecevied(OSNotification notification)
        {
            if (notification.payload?.additionalData == null)
            {
                return;
            }

            if (notification.payload.additionalData.ContainsKey("body"))
            {
                var labelText = notification.payload.additionalData["body"].ToString();
                Settings.LastNotify  = labelText;
                App.Current.MainPage = new NotificationSummaryPage();
            }
        }
        public static void HandleNotificationReceived(OSNotification notification)
        {
            OSNotificationPayload payload = notification.payload;

            if (payload.additionalData.TryGetValue("Types", out var types))
            {
                var t = types.ToString();
                //trả về parameter thích làm gì thì làm
                if (payload.additionalData.TryGetValue("Value", out var values))
                {
                }
                ;
            }
            ;
        }
            public void NotificationReceived(OSNotification p0)
            {
                if (p0 == null || p0.Payload == null)
                {
                    return;
                }
                _data = p0.Payload.AdditionalData;

                //Action to do when the app is in focus (update UI etc)
                //if (p0.IsAppInFocus && _data != null)
                if (_data != null)
                {
                    HandleNotificationData(_data);
                }
                //Action to do when the app is not in focus (save the notification to execute it later)
                //else if (_data != null) SaveDataForNextAppResume(_data);
            }
    private void HandleNotificationReceived(OSNotification notification)
    {
        OSNotificationPayload payload = notification.payload;
        string message = payload.body;
        Dictionary <string, object> additionalData = payload.additionalData;



        if (additionalData == null)
        {
            Debug.Log("[HandleNotificationReceived] Additional Data == null");
        }
        else
        {
            var jsonString = JSON.Parse(Json.Serialize(additionalData) as string);

            PlayerPrefs.SetString("MultiBattle", jsonString["from"]);


            if (int.Parse(jsonString["from"]) == 99)
            {
                PlayerPrefs.SetInt("pos", 2);
                PlayerPrefs.SetString("RoomName", jsonString ["room"]);
                PlayerPrefs.SetString(Link.USER_2, PlayerPrefs.GetString(Link.FULL_NAME));
                PlayerPrefs.SetString(Link.USER_1, jsonString ["full_name_people"]);

                StartCoroutine(kurangEnergy());
            }
            else
            {
                if (PlayerPrefs.GetString(Link.INVITE_CLICK) != "TRUE")
                {
                    warningInvitating.SetActive(true);
                    warningInvitating.GetComponent <Warning> ().from             = PlayerPrefs.GetString("MultiBattle");
                    warningInvitating.GetComponent <Warning> ().idYangMengajak   = jsonString["idYangMengajak"].ToString();
                    warningInvitating.GetComponent <Warning> ().namaYangMengajak = jsonString["namaYangMengajak"].ToString();
                    warningInvitating.transform.FindChild("User").GetComponent <Text> ().text = warningInvitating.GetComponent <Warning> ().namaYangMengajak;
                    idajak   = jsonString ["idYangMengajak"];
                    namaajak = jsonString ["namaYangMengajak"];
                }
            }

            //confirming.text ="addtional data : "+Json.Serialize(additionalData) as string+"from : "+jsonString["from"]+"from2 : "+jsonString["from"].ToString()+"klik"+PlayerPrefs.GetString(Link.INVITE_CLICK);
        }
    }
        private void HandlePayload(OSNotification notification)
        {
            var payload = new NotificationPayload();

            payload.EventType = GetPayloadItem(notification, eventTypeKey);
            payload.Event     = GetPayloadItem(notification, eventKey);
            payload.Message   = GetPayloadItem(notification, messageKey);

            bool payloadCompleted = !string.IsNullOrEmpty(payload.Event) && !string.IsNullOrEmpty(payload.EventType);

            if (payloadCompleted)
            {
                PayloadReceived?.Invoke(this, new PayloadReceivedEventArgs()
                {
                    Payload = payload
                });
            }
        }
        //--------------------------------------------------------
        // OneSignal Remote Notification Event Handlers
        //--------------------------------------------------------

        // Called when your app is in focus and a notification is recieved (no action taken by the user).
        private void HandleOneSignalNotificationReceived(OSNotification notification)
        {
            // If isAppInFocus == false, the app was brought to foreground by user opening the notification directly and
            // HandleOneSignalNotificationOpened will be invoked, so we'll ignore such case to prevent firing duplicate events.
            // If isAppInFocus == true, the notification is received when the app is in foreground and not posted to
            // the notification center/system tray (and HandleOneSignalNotificationOpened never gets invoked), so no
            // risk of duplicate events.
            if (notification.isAppInFocus)
            {
                var delivered = OneSignalHelper.ToCrossPlatformRemoteNotification(null, notification);

                // Fire event
                if (RemoteNotificationOpened != null)
                {
                    RemoteNotificationOpened(delivered);
                }
            }
        }
Exemple #21
0
    private static void HandleNotificationReceived(OSNotification notification)
    {
        OSNotificationPayload payload = notification.payload;
        string message = payload.body;

        print("GameControllerExample:HandleNotificationReceived: " + message);
        print("displayType: " + notification.displayType);

        Dictionary <string, object> additionalData = payload.additionalData;

        if (additionalData == null)
        {
            Debug.Log("[HandleNotificationReceived] Additional Data == null");
        }
        else
        {
            Debug.Log("[HandleNotificationReceived] message " + message + ", additionalData: " + Json.Serialize(additionalData) as string);
        }
    }
        private OSNotificationApp OSNotificationToNative(OSNotification notif)
        {
            var notification = new OSNotificationApp();

            notification.DisplayTypeNotification = (OSNotificationApp.DisplayType)notif.DisplayType;
            notification.Shown = notif.Shown;
            notification.SilentNotification = notif.SilentNotification;
            notification.Payload            = new OSNotificationPayloadApp();

            notification.Payload.ActionButtons = new List <Dictionary <string, object> >();
            if (notif.Payload.ActionButtons != null)
            {
                for (int i = 0; i < (int)notif.Payload.ActionButtons.Count; ++i)
                {
                    var element = notif.Payload.ActionButtons.GetItem <Foundation.NSDictionary>((uint)i);
                    if (element.ToString().IsJson())
                    {
                        notification.Payload.ActionButtons.Add(JsonConvert.DeserializeObject <Dictionary <string, object> >(element.ToString()));
                    }
                }
            }

            notification.Payload.AdditionalData = new Dictionary <string, object>();
            if (notif.Payload.AdditionalData != null)
            {
                foreach (KeyValuePair <Foundation.NSObject, Foundation.NSObject> element in notif.Payload.AdditionalData)
                {
                    notification.Payload.AdditionalData.Add((Foundation.NSString)element.Key, element.Value);
                }
            }

            notification.Payload.Badge            = (int)notif.Payload.Badge;
            notification.Payload.Body             = notif.Payload.Body;
            notification.Payload.ContentAvailable = notif.Payload.ContentAvailable;
            notification.Payload.LaunchURL        = notif.Payload.LaunchURL;
            notification.Payload.NotificationID   = notif.Payload.NotificationID;
            notification.Payload.Sound            = notif.Payload.Sound;
            notification.Payload.Subtitle         = notif.Payload.Subtitle;
            notification.Payload.Title            = notif.Payload.Title;

            return(notification);
        }
Exemple #23
0
        public static async void NotificacaoRecebida(OSNotification result)
        {
            var notificacao = result.payload;

            if (Principal.Repositorio != null && notificacao != null)
            {
                await Principal.Repositorio.AdicionarOuAtualizarAsync(new Notificacao
                {
                    Identificacao = notificacao.notificationID,
                    Titulo        = notificacao.title,
                    Mensagem      = notificacao.body,
                    DataAgendada  = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")
                });

                AcoesNotificacaoRecebida.Where(x => x.Value != null).OrderBy(x => x.Key).Select(x => x.Value).ToList().ForEach(x => x.Invoke());
            }
            else
            {
                await Principal.Mensagem($"Não foi possível adicionar {nameof(Notificacao)}!");
            }
        }
      private OSNotification OSNotificationToNative(iOS.OSNotification notif)
      {
         var notification = new OSNotification();
         notification.displayType = (OSNotification.DisplayType)notif.DisplayType;
         notification.shown = notif.Shown;
         notification.silentNotification = notif.SilentNotification;
         
         notification.payload = new OSNotificationPayload();


         notification.payload.actionButtons = new List<Dictionary<string, object>>();
         if (notif.Payload.ActionButtons != null)
         {
            for (int i = 0; i < (int)notif.Payload.ActionButtons.Count; ++i)
            {
               Foundation.NSDictionary element = notif.Payload.ActionButtons.GetItem<Foundation.NSDictionary>((uint)i);
               notification.payload.actionButtons.Add(NSDictToPureDict(element));
            }
         }

         notification.payload.additionalData = new Dictionary<string, object>();
         if (notif.Payload.AdditionalData != null)
         {
            foreach (KeyValuePair<Foundation.NSObject, Foundation.NSObject> element in notif.Payload.AdditionalData)
            {
               notification.payload.additionalData.Add((Foundation.NSString)element.Key, element.Value);
            }
         }

         notification.payload.badge = (int)notif.Payload.Badge;
         notification.payload.body = notif.Payload.Body;
         notification.payload.contentAvailable = notif.Payload.ContentAvailable;
         notification.payload.launchURL = notif.Payload.LaunchURL;
         notification.payload.notificationID = notif.Payload.NotificationID;
         notification.payload.sound = notif.Payload.Sound;
         notification.payload.subtitle = notif.Payload.Subtitle;
         notification.payload.title = notif.Payload.Title;

         return notification;
      }
Exemple #25
0
    // Called when your app is in focus and a notificaiton is recieved.
    // The name of the method can be anything as long as the signature matches.
    // Method must be static or this object should be marked as DontDestroyOnLoad
    private static void HandleNotificationReceived(OSNotification notification)
    {
        //OSNotificationPayload payload = notification.payload;

        //      Debug.Log("ReceivedPush");

        //string message = payload.body;

        //print("GameControllerExample:HandleNotificationReceived: " + message);
        //print("displayType: " + notification.displayType);
        //string extraMessage = "Notification received with text: " + message;

        ////TODO when app is open set this as last message from user...

        //Dictionary<string, object> additionalData = payload.additionalData;


        //if (additionalData != null && additionalData.ContainsKey("chatUser"))
        //{
        //    int temp = 0;

        //    if (additionalData["chatUser"].GetType() == typeof(string))
        //    {
        //        temp = int.Parse(additionalData["chatUser"].ToString());
        //    }
        //    else
        //    {
        //        temp = (int)(long)additionalData["chatUser"];
        //    }

        //    if (OnReceivePushText != null) OnReceivePushText(temp, message);
        //}

        //if (additionalData == null)
        //    Debug.Log("[HandleNotificationReceived] Additional Data == null");
        //else
        //Debug.Log("[HandleNotificationReceived] message " + message + ", additionalData: " + Newtonsoft.Json.JsonConvert.SerializeObject(additionalData));
    }
Exemple #26
0
        // Called when your app is in focus and a notificaiton is recieved.
        // The name of the method can be anything as long as the signature matches.
        // Method must be static or this object should be marked as DontDestroyOnLoad
        private static void HandleNotificationReceived(OSNotification notification)
        {
            OSNotificationPayload payload = notification.payload;
            string message = payload.body;
            Dictionary <string, object> additionalData = payload.additionalData;

            if (additionalData != null)
            {
                if (additionalData.ContainsKey("mdn_area"))
                {
                    CrossSettings.Current.Set("atualizarDados", true);
                }
                if (additionalData.ContainsKey("logout"))
                {
                    CrossSettings.Current.Clear();
                    AppNavigationService.NavigateAsync("NavigationPage/Logar");
                }
                if (additionalData.ContainsKey("tempoEsperaAceitacao"))
                {
                    CrossSettings.Current.Set("dataRecebimentoChamada", DateTime.Now);
                }
            }
        }
Exemple #27
0
        void HandleNotificationReceived(OSNotification notification)
        {
            /*if(!String.IsNullOrEmpty(notification.payload.body))
             * {
             *
             *
             *    ChatRecord chat = new ChatRecord
             *    {
             *        Content = notification.payload.body ,
             *        Sender = "OtherPPL",
             *        updatedDate = DateTime.Now ,
             *        BackgroundColor = "#cedcff"
             *    };
             *
             *    App.Database.SaveChat(chat);
             *
             *    MessagingCenter.Send<App>((App)Application.Current, "Testing");
             * }*/


            Ultis.Settings.RefreshListView = "Yes";
            MessagingCenter.Send <App>((App)Application.Current, "Testing");
        }
Exemple #28
0
    private void HandleNotificationReceived(OSNotification notification)
    {
        OSNotificationPayload payload = notification.payload;
        string message = payload.body;
        Dictionary <string, object> additionalData = payload.additionalData;

        warningInvitating.SetActive(true);


        if (additionalData == null)
        {
            Debug.Log("[HandleNotificationReceived] Additional Data == null");
        }
        else
        {
            var jsonString = JSON.Parse(Json.Serialize(additionalData) as string);

            //PlayerPrefs.SetString (Link.INVITE_ROOM, jsonString["invite_room"]);


            PlayerPrefs.SetString(Link.FOR_CONVERTING, jsonString["from"]);
            warningInvitating.SetActive(true);
            warningInvitating.GetComponent <Warning> ().from             = PlayerPrefs.GetString(Link.FOR_CONVERTING);
            warningInvitating.GetComponent <Warning> ().idYangMengajak   = jsonString["idYangMengajak"];
            warningInvitating.GetComponent <Warning> ().namaYangMengajak = jsonString["namaYangMengajak"];

            if (PlayerPrefs.GetString(Link.FOR_CONVERTING) == "2")
            {
                warningInvitating.transform.FindChild("name").GetComponent <Text> ().text = warningInvitating.GetComponent <Warning> ().namaYangMengajak;
            }
            else if (PlayerPrefs.GetString(Link.FOR_CONVERTING) == "3")
            {
                warningInvitating.transform.FindChild("name").GetComponent <Text> ().text = warningInvitating.GetComponent <Warning> ().namaYangMengajak + " Request To Join";
            }
        }
    }
 // Called when your app is in focus and a notificaiton is recieved.
 // The name of the method can be anything as long as the signature matches.
 // Method must be static or this object should be marked as DontDestroyOnLoad
 private void HandleNotificationReceived(OSNotification notification)
 {
     OnOneSignalNotificationReceived(notification);
 }
    /*** protected and private methods ****/
#if ONESIGNAL_PLATFORM
    private OSNotification DictionaryToNotification(Dictionary <string, object> jsonObject)
    {
        OSNotification        notification = new OSNotification();
        OSNotificationPayload payload      = new OSNotificationPayload();

        //Build OSNotification object from jsonString
        var payloadObj = jsonObject["payload"] as Dictionary <string, object>;

        if (payloadObj.ContainsKey("notificationID"))
        {
            payload.notificationID = payloadObj["notificationID"] as string;
        }
        if (payloadObj.ContainsKey("sound"))
        {
            payload.sound = payloadObj["sound"] as string;
        }
        if (payloadObj.ContainsKey("title"))
        {
            payload.title = payloadObj["title"] as string;
        }
        if (payloadObj.ContainsKey("body"))
        {
            payload.body = payloadObj["body"] as string;
        }
        if (payloadObj.ContainsKey("subtitle"))
        {
            payload.subtitle = payloadObj["subtitle"] as string;
        }
        if (payloadObj.ContainsKey("launchURL"))
        {
            payload.launchURL = payloadObj["launchURL"] as string;
        }
        if (payloadObj.ContainsKey("additionalData"))
        {
            if (payloadObj["additionalData"] is string)
            {
                payload.additionalData = Json.Deserialize(payloadObj["additionalData"] as string) as Dictionary <string, object>;
            }
            else
            {
                payload.additionalData = payloadObj["additionalData"] as Dictionary <string, object>;
            }
        }
        if (payloadObj.ContainsKey("actionButtons"))
        {
            if (payloadObj["actionButtons"] is string)
            {
                payload.actionButtons = Json.Deserialize(payloadObj["actionButtons"] as string) as Dictionary <string, object>;
            }
            else
            {
                payload.actionButtons = payloadObj["actionButtons"] as Dictionary <string, object>;
            }
        }
        if (payloadObj.ContainsKey("contentAvailable"))
        {
            payload.contentAvailable = (bool)payloadObj["contentAvailable"];
        }
        if (payloadObj.ContainsKey("badge"))
        {
            payload.badge = (int)payloadObj["badge"];
        }
        if (payloadObj.ContainsKey("smallIcon"))
        {
            payload.smallIcon = payloadObj["smallIcon"] as string;
        }
        if (payloadObj.ContainsKey("largeIcon"))
        {
            payload.largeIcon = payloadObj["largeIcon"] as string;
        }
        if (payloadObj.ContainsKey("bigPicture"))
        {
            payload.bigPicture = payloadObj["bigPicture"] as string;
        }
        if (payloadObj.ContainsKey("smallIconAccentColor"))
        {
            payload.smallIconAccentColor = payloadObj["smallIconAccentColor"] as string;
        }
        if (payloadObj.ContainsKey("ledColor"))
        {
            payload.ledColor = payloadObj["ledColor"] as string;
        }
        if (payloadObj.ContainsKey("lockScreenVisibility"))
        {
            payload.lockScreenVisibility = Convert.ToInt32(payloadObj["lockScreenVisibility"]);
        }
        if (payloadObj.ContainsKey("groupKey"))
        {
            payload.groupKey = payloadObj["groupKey"] as string;
        }
        if (payloadObj.ContainsKey("groupMessage"))
        {
            payload.groupMessage = payloadObj["groupMessage"] as string;
        }
        if (payloadObj.ContainsKey("fromProjectNumber"))
        {
            payload.fromProjectNumber = payloadObj["fromProjectNumber"] as string;
        }
        notification.payload = payload;

        if (jsonObject.ContainsKey("isAppInFocus"))
        {
            notification.isAppInFocus = (bool)jsonObject["isAppInFocus"];
        }
        if (jsonObject.ContainsKey("shown"))
        {
            notification.shown = (bool)jsonObject["shown"];
        }
        if (jsonObject.ContainsKey("silentNotification"))
        {
            notification.silentNotification = (bool)jsonObject["silentNotification"];
        }
        if (jsonObject.ContainsKey("androidNotificationId"))
        {
            notification.androidNotificationId = Convert.ToInt32(jsonObject["androidNotificationId"]);
        }
        if (jsonObject.ContainsKey("displayType"))
        {
            notification.displayType = (OSNotification.DisplayType)Convert.ToInt32(jsonObject["displayType"]);
        }

        return(notification);
    }
Exemple #31
0
    // **************************
    // Private/Helper functions
    // **************************

    // Gets called when the player receives the notification.
    private static void HandleNotificationReceived(OSNotification result)
    {
    }
Exemple #32
0
 private static void HandleNotificationReceived(OSNotification notification)
 {
 }