Exemplo n.º 1
0
        public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action <UIBackgroundFetchResult> completionHandler)
        {
            if (application.ApplicationState == UIApplicationState.Inactive)
            {
                var data = PushNotificationHandler.GetParameters(userInfo);
                App.OnNotificationOpened(null, new FirebasePushNotificationResponseEventArgs(data));
                completionHandler(UIBackgroundFetchResult.NewData);
                return;
            }

            FirebasePushNotificationManager.DidReceiveMessage(userInfo);
            completionHandler(UIBackgroundFetchResult.NewData);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Method to subscribe push using Windows Azure
        /// </summary>
        public async void SuscribePush()
        {
            if (string.IsNullOrWhiteSpace(ApId) || string.IsNullOrEmpty(ApId))
            {
                ApId = Convert.ToString(Guid.NewGuid());
                Regex rgx = new Regex("[^a-zA-Z0-9]");
                ApId = rgx.Replace(ApId, "");
            }

            string[] UniqueID = { "ApId" };
            UniqueID[0] = ApId;
            _pushNotificationHandler = new PushNotificationHandler();
            await _pushNotificationHandler.SubscribeToPushes(UniqueID);
        }