Пример #1
0
        public static void RegisterNotificationDevice()
        {
            try
            {
                if (UserDetails.NotificationPopup)
                {
                    if (!string.IsNullOrEmpty(AppSettings.OneSignalAppId) || !string.IsNullOrWhiteSpace(AppSettings.OneSignalAppId))
                    {
                        Com.OneSignal.OneSignal.Current.StartInit(AppSettings.OneSignalAppId)
                        .InFocusDisplaying(OSInFocusDisplayOption.Notification)
                        .HandleNotificationReceived(HandleNotificationReceived)
                        .HandleNotificationOpened(HandleNotificationOpened)
                        .EndInit();
                        Com.OneSignal.OneSignal.Current.IdsAvailable(IdsAvailable);
                        Com.OneSignal.OneSignal.Current.RegisterForPushNotifications();
                        Com.OneSignal.OneSignal.Current.SetSubscription(true);
                        AppSettings.ShowNotification = true;
                    }
                }
                else
                {
                    Un_RegisterNotificationDevice();
                }

                MsgOneSignalNotification.RegisterNotificationDevice();
            }
            catch (Exception ex)
            {
                Methods.DisplayReportResultTrack(ex);
            }
        }
Пример #2
0
        public static void Un_RegisterNotificationDevice()
        {
            try
            {
                Com.OneSignal.OneSignal.Current.SetSubscription(false);
                Com.OneSignal.OneSignal.Current.ClearAndroidOneSignalNotifications();
                AppSettings.ShowNotification = false;

                MsgOneSignalNotification.Un_RegisterNotificationDevice();
            }
            catch (Exception ex)
            {
                Methods.DisplayReportResultTrack(ex);
            }
        }