Esempio n. 1
0
        protected override void OnHandleIntent(Intent intent)
        {
            try
            {
                Context context = this.ApplicationContext;
                string  action  = intent.Action;

                if (action.Equals("com.google.android.c2dm.intent.REGISTRATION"))
                {
                    ServiceHelper helper = ServiceHelper.GetInstance();
                    helper.SetPushIdentifier(intent.GetStringExtra("registration_id"));
                }
                else if (action.Equals("com.google.android.c2dm.intent.RECEIVE"))
                {
                    //HandleMessage(context, intent);
                    PlatformSpecific.GetInstance().LogInfo("Push received!");
                }
            }
            finally
            {
                lock (LOCK)
                {
                    //Sanity check for null as this is a public method
                    if (sWakeLock != null)
                    {
                        sWakeLock.Release();
                    }
                }
            }
        }
Esempio n. 2
0
        private async void InitNotificationsAsync()
        {
            // Request a push notification channel.
            var channel =
                await PushNotificationChannelManager
                .CreatePushNotificationChannelForApplicationAsync();

            // Register for notifications using the new channel
            //await MobileService.GetPush().RegisterNativeAsync(channel.Uri);
            ServiceHelper.GetInstance().SetPushIdentifier(channel.Uri);

            PlatformSpecific.GetInstance().LogInfo("Push uri: " + channel.Uri);
        }