internal static PushMessage FromJson(string jsonString)
        {
            PushMessage pushMessage = JsonUtility.FromJson <PushMessage> (jsonString);

            if (pushMessage.Alert == null && pushMessage.Identifier == null && pushMessage.Extras == null)
            {
                return(null);
            }
            return(pushMessage);
        }
Exemple #2
0
        /// <summary>
        /// Gets the last stored incoming push message.
        /// </summary>
        /// <returns>The push message.</returns>
        /// <param name="clear">If set to <c>true</c> clear the stored push message after accessing it.</param>
        public PushMessage GetIncomingPush(bool clear = true)
        {
            string jsonPushMessage = plugin.GetIncomingPush(clear);

            if (String.IsNullOrEmpty(jsonPushMessage))
            {
                return(null);
            }

            PushMessage pushMessage = PushMessage.FromJson(jsonPushMessage);

            return(pushMessage);
        }
Exemple #3
0
            void OnPushReceived(string payload)
            {
                PushReceivedEventHandler handler = UAirship.Shared.OnPushReceived;

                if (handler == null)
                {
                    return;
                }

                PushMessage pushMessage = PushMessage.FromJson(payload);

                if (pushMessage != null)
                {
                    handler(pushMessage);
                }
            }
 protected override void OnPushReceived(Context context, PushMessage message, bool notificationPosted)
 {
     Log.Info (TAG, "Received push message. Alert: " + message.Alert + ". Notification posted: " + notificationPosted);
 }