Reputation: 1013
First of all, I'm new in developing iOS app and I'm using Swift.
I want to let user know that my app is running/not running in the background, so whenever my app that is running in the background gets terminated, the user can open the app again.
I first thought if I push a repeating local notification inside
func applicationWillTerminate(_ application: UIApplication)
and then when the app is opened again cancel the notification, it would work. But unfortunately, I found out that applicationWillTerminate this function will not be called everytime the app is terminated.
Also, it seems not possible (as far as I know) to display an icon in the status bar when the app is running in the background. (And it seems bothersome to users to keep pushing notifications when it is kept running.)
Is there any way to let the user know the app is running in the background or not running in the background?
I'm trying to get Bluetooth signal to track the indoor position of the user (using beacons) to gather data of how users are moving inside a place. But I need to make the app keep running in the background in order to keep updating the position. Then is it possible to wake / launch my app in background when it is not running?
Upvotes: 0
Views: 88
Reputation: 119242
I'm trying to get Bluetooth signal to track the indoor position of the user (using beacons) to gather data of how users are moving inside a place.
Your app can register to monitor for beacons while in the background, and will be launched or woken in the background whenever it detects new beacons. You'll have a short amount of time to perform updates when this happens.
See Apple documentation here or this tutorial for information to get you started.
Upvotes: 2