I want to get notification when app is terminated to notify users that you need to keep app running to get app updates.
I also want to repeat notifications every 72 hours if app is not running.
For now, I have implemented local notification however, I am not able to repeat notifications. Moreover, when I reboot device and app is in background, I do not get notification until I relaunch app manually.
What is the best solution for this scenario, do I need to implement Push notification or is it possible with local notification?
Would anybody mind to help me, I will really appreciate it!
Thanks in advance!
You need to use
BGAppRefreshTask
in conjunction with aBGTaskScheduler
. First, add a new capability to your target:Background Modes
and selectBackground fetch
. Next, Register your task identifier in the Info.plist underPermitted background task scheduler identifiers
. e.g.UpdateApp
further explanation and details: Apple Background Tasks
you can use this for your current idea of notifying the user every 72 hours, or you can just perform the app updates in the background using a
BGProcessingTask
instead of aBGAppRefreshTask
if the updates require more time to complete than a simple refresh task.