简体   繁体   中英

How to run ios application in background on device restart?

I am working on Location Tracking Application. This application continuously send location even in background. I am using SLC property.

I am also using silent push trick for location tracking. Logic of Silent push: Check AppIconbadge number and perform the action according to AppIconbadge number. I have a timer which check AppIconbadge at every 10 seconds.

Now this is the case: Device is on SLC and put the app in background and turn off the device. While you switch back to On this device it is still reporting on SLC while Ping (Silent Push) is not working.

I have started the timer when app get SLC trigger. But its not working.

Can you help?

You can't do it.

The way iOS achieves great battery life and reduces RAM usage makes this kind of thing impossible.

Your only real possibility is to have your server send occasional push notifications to the device, and have your app on the device respond with its location. This is how Find My Phone and Find My Friends both work. The idea is to improve battery life by doing as much as possible on a server, which has mains power and virtually unlimited RAM, instead of on the phone which only has a battery and might need all it's RAM to play a 3D game

Basically the CPU is not running at all most of the time, so it can't schedule stuff to run periodically, and you can't rely on there being enough RAM available to run your app so it also can't be running all the time even if the CPU is powered on.

According to the WWDC 2013 keynote, push notifications are much more powerful on iOS 7, so you should look that up (I haven't looked into it myself, just saw the keynote.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM