private async Task CheckNotification(IJobParameters @params) { try { Log.Debug("PUSTERA_TAG", "Starting notifiation check"); (Notification notification, string message) = await APIService.CheckNotification(); if (notification != null) { var notifService = new NotificationService(this); notifService.Notify(notification); } Log.Error("PUSTERA_TAG", "Finished message.." + message + " :"); Log.Debug("PUSTERA_TAG", "Finished notifiation check.." + notification?.Date ?? ""); JobFinished(@params, true); Log.Debug("PUSTERA_TAG", "Job finished"); } catch (Exception bug) { Log.Debug("PUSTERA_TAG", bug.Message); } }
public async override void PerformFetch(UIApplication application, Action <UIBackgroundFetchResult> completionHandler) { (Notification notification, string message) = await APIService.CheckNotification(); if (notification != null) { new NotificationService().Notify(notification); completionHandler(UIBackgroundFetchResult.NewData); } else { completionHandler(UIBackgroundFetchResult.NoData); } }