// This method should be used to release shared resources and it should store the application state. // If your application supports background exection this method is called instead of WillTerminate // when the user quits. public override void DidEnterBackground(UIApplication uiApplication) { (SensusContext.Current.Notifier as IiOSNotifier).CancelSilentNotifications(); iOSSensusServiceHelper serviceHelper = SensusServiceHelper.Get() as iOSSensusServiceHelper; serviceHelper.IssuePendingSurveysNotificationAsync(true, true); // save app state in background nint saveTaskId = uiApplication.BeginBackgroundTask(() => { }); serviceHelper.SaveAsync(() => { uiApplication.EndBackgroundTask(saveTaskId); }); }
// This method should be used to release shared resources and it should store the application state. // If your application supports background exection this method is called instead of WillTerminate // when the user quits. public override void DidEnterBackground(UIApplication uiApplication) { iOSSensusServiceHelper serviceHelper = SensusServiceHelper.Get() as iOSSensusServiceHelper; // app is no longer active, so reset the activation ID serviceHelper.ActivationId = null; serviceHelper.IssuePendingSurveysNotificationAsync(true, true); // save app state in background nint saveTaskId = uiApplication.BeginBackgroundTask(() => { }); serviceHelper.SaveAsync(() => { uiApplication.EndBackgroundTask(saveTaskId); }); }
// This method should be used to release shared resources and it should store the application state. // If your application supports background exection this method is called instead of WillTerminate // when the user quits. public override void DidEnterBackground(UIApplication uiApplication) { (SensusContext.Current.CallbackScheduler as iOSCallbackScheduler).CancelSilentNotifications(); iOSSensusServiceHelper serviceHelper = SensusServiceHelper.Get() as iOSSensusServiceHelper; serviceHelper.IssuePendingSurveysNotificationAsync(null, true); // save app state in background nint saveTaskId = uiApplication.BeginBackgroundTask(() => { // not much we can do if we run out of time... }); serviceHelper.SaveAsync(() => { uiApplication.EndBackgroundTask(saveTaskId); }); }