0

Scenario: Backend returns a list of appointments with timings and their priorities for the current day (24 hours). iOS application checks for the most important (top priority) meeting and schedule local notification for that particular appointment time.

Requirement: Ideally app should notify user about the most important appointment of the day. So App should fetch the data at-least once in 24 hours (As backend data gets updated for each day) to schedule local notifications for each day.

Problem: To trigger background downloading (Other than background-fetch) reliably and periodically (once in 24 hours) and and execute small code (to schedule local notifications) even after user force quits the application.

I have implemented background fetch to download the data if app is in suspended or in background mode, although it is not reliable. The main problem occurs when user force quit the application from multitasking window (by swiping-up), iOS does not trigger background fetch most of the time (As per the apple documentation, and it is happening in my case as well).

App downloads the data and works fine if user opens it at-least once a day.

I read that silent remote notification can trigger the code by using notification-service-extention, but that need backend to trigger the notification. Is there any way if I can schedule silent local notifications to trigger run code in notification-service-extention

Ankush
  • 2,405
  • 3
  • 22
  • 45
  • 1
    If the user has force quit your app then silent notifications are not delivered either. If the user force quit your app then the implication is that they don't want your app to run and so they shouldn't expect updated information – Paulw11 Feb 27 '18 at 17:49
  • Oh Okay, so there is no way? – Ankush Feb 28 '18 at 09:06
  • you can try a little combo here: you always can try a _push_ way (e.g. silent notifications) then you can double check for your content via _pull_ (e.g. direct API call) when you app opens, so you will know whether your app has the latest information before the user start using it (if not, you can gather the latest data via the API on the fly). – holex Feb 28 '18 at 09:40
  • In my case I need to schedule one local notification daily for user, the local notification's time needs to be calculated by latest API data. the system works well when user opens the app. But if user force quit app and does not relaunch, My app is not able to fetch data in background, so that I can schedule local notification based on fresh data, in case app is not running – Ankush Feb 28 '18 at 09:57

0 Answers0