コード例 #1
0
        public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo,
                                                          Action <UIBackgroundFetchResult> completionHandler)
        {
            var payload = DictionaryToJson(userInfo);

            SNSUtils.HandleMessage(payload);
        }
コード例 #2
0
        private void HandleMessage(Intent intent)
        {
            if (intent.Extras != null && !intent.Extras.IsEmpty)
            {
                Debug.WriteLine("GCM Listener - Push Received");

                var values = new JObject();

                foreach (var key in intent.Extras.KeySet())
                {
                    var value = intent.Extras.Get(key).ToString();
                    values.Add(key, value);
                }
                var message = intent.Extras.GetString("message");

                CreateNotification("Notification", message, intent.Extras);
                SNSUtils.HandleMessage(values.ToString());
            }
        }
コード例 #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Forms.Forms.Init(this, bundle);
            RegisterForGCM();
            LoadApplication(new App());
            if (Intent.Extras != null && !Intent.Extras.IsEmpty)
            {
                Debug.WriteLine("GCM Listener - Push Received");

                var values = new JObject();

                foreach (var key in Intent.Extras.KeySet())
                {
                    var value = Intent.Extras.Get(key).ToString();
                    values.Add(key, value);
                }
                SNSUtils.HandleMessage(values.ToString());
            }
        }