iOS - Repeat notification every 72 hours

54 views Asked by At

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!

1

There are 1 answers

3
ɯɐɹʞ On

You need to use BGAppRefreshTask in conjunction with a BGTaskScheduler. First, add a new capability to your target: Background Modes and select Background fetch. Next, Register your task identifier in the Info.plist under Permitted 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 a BGAppRefreshTask if the updates require more time to complete than a simple refresh task.