Saw an app called PhoneRecover on the AppStore.
They advertise the following:
PhoneRecover will automatically restart after a reboot on the iPhone 3GS and the iPhone 4 running iOS4.
How is this possible? What APIs are used to auto-launch an app after a boot?
It's built into multi-tasking. "Backgrounded" apps are still in background after a reboot. Presumably the app does some work to re-instantiate itself and get its state going again the first time Core Location hits it in the background, but there's no other magic happening here. Any background-aware app will survive a reboot in a backgrounded state.
I wouldn't count on this. I was running MotionX GPS and let the battery run completely dead. Upon restart MotionX was no longer running, broadcasting my position or tracking my position. The broadcast option is persistent too (survives app restart).
Related
I am developing an app which uses CLLocationManager to track user's current location.
As soon as I launch app, it works well till the end of the day, I used to get the user's location till evening 5'o clock.
I want my app to start automatically on the next day morning, without launching the app but my app is running in the background.
I just want to work like alarm manager in android. Any suggestions?
I want CLLocationManager to startUpdatingLocation even when the device is rebooted without launching the app [while switching off the device, the app is running in background]
How to implement this?
iOS will relaunch apps that sign up for location changes! This works under ios6 already! BUT to the background only. So that the location can be tracked
see e.g. the 'Moves' app that will track your location
the idea is that you're app wakes to the background mode.
see:
Will iOS wake up the terminated app if it's registered with location for UIBackgroundModes?
pay attention to:
App won't relaunch when monitoring CLLocationManager significant location changes - iPhone
compare with:
http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html
You simply can't do what you want with iOS 6 or lower (app can't launch itself on those iOS versions), workaround would be to alarm user to launch your app with local notifications. But iOS 7 comes with some new features, and allows certain apps to wake at the background to complete tasks.
You can not make startUpdatingLocation(didUpdateLocations) automatically run after reboot. You have to
1. use startMonitoringForRegion ;
2. or use a remote notification to invoke startUpdatingLocation.
I've seen application on iphone called "moves"
the gps is running on background while the application is totaly closed and not working in the background.
how can i get the location of the user and send it to the application while it is closed and not working on background? how could this possible?
what is the function to do that?
thanks
It is possible to get the location while the phone is running in the background (The Google Maps app does this), however running a background thread is a privilege that you must justify to Apple in their review process.
Here is some documentation by Apple for guidelines for running in the background
You register for the significant-change location service.
According to the Apple docs:
If the app starts this service and is then terminated, the system relaunches the app automatically when a new location becomes available.
This is not possible for an App on a non jailbraked iphone. Check again what you really have seen.
Apps can run in the background and get locations. But an app which is closed, can not do anything, since it is not running.
Maybe you have sawn the GPS Arrow in the status bar, staying active. But this disappears after some seconds, as long as no other application uses GPS.
I have a map based and location based app which I put into the background. I then start a a game app (agent dash) after the game app has finished initializing I noticed that my app has been killed: 9 in the device log. Sometimes I get a memory warning message, sometimes not. But is it possible for one app to cause another to be terminated. If I run the my app on its own there is no problem. I run other apps in the foreground and no problem. Also if an app can cause mine to be terminated can I generate a restart? Thanks
Agent dash must be an memory intensive app, so when the iOS feels its running out of memory it generates memory warnings which each app needs to handle. It can even kill your app if it needs more memory. The primary thing iOS takes into consideration is that it wants to keep the app which the user is using alive. And no you can't restart your app pro grammatically the user will have to do it if he wants to.
I am developing an iphone application and I think that it's business logic requires a service to be always running in background.
The service needed is to get the acceleration of the device and notify or perform a certain action when that acceleration becomes a certain value.
Is that allowable in the Apple policies, or is there any idea about a solution?
What cydia development possibilities to help me ?
Dbramhall left out one important thing:
You can't guarantee that your app won't be killed, the OS can kill apps that are in the background at will if it requires more memory.
So if at all possible i wouldn't rely on making sure it can run its process in the background and before you ask "How can i stop this?". Well you shouldn't I've never tried it myself because i don't know the effects it has on the OS.
Also if you stop it from being killed in the Background, if it is going to be on the app store then it won't pass evaluation process, because it breaks the OS
Well, an application can run in the background and Apple perfectly accepts this however the user will obviously be be able to close the application (or should be able to) via the multi-tasking bar and this will end the application. Period.
Apple will not accept an application that runs constantly regardless of whether the user has is in background state as this drains the battery, heats the device etc. So an application can run in the background so long as the user can quit it when close it from the multi-tasking bar however it cannot continue to run after the user closed it via multi-tasking - if it does continue, Apple will reject the application.
Also, see 2.16 of the Apple Store review guidelines: https://developer.apple.com/appstore/resources/approval/guidelines.html#functionality
From the Core Location documentation:
The regions you register with the location manager persist between launches of
your application. If a region crossing occurs while your application is not
running, the system automatically wakes up your application (or relaunches it)
in the background so that it can process the event. When relaunched, all of
the regions you configured previously are made available in the
monitoredRegions property of any location manager objects you create.
Unfortunately, this is unclear as to whether or not the same app will also be relaunched after device reboot in response to a region change.
Will an iOS app that monitors significant location changes in the background still be relaunched, even after a device reboot?
Yes, your app will be launched to respond to the region events even if the phone is restarted, and even if the user did not explicitly run your app after the reboot.
I haven't seen any documentation that spells that out clearly. But this is how it works in a couple of my own apps.
Just to make an update. I know that this is an old question, but I want to confirm that it works on iOS7, even after a reboot.
Check my question here:
Are background mode location and fetch called even after the device restarted in iOS7?