We're developing iPhone GPS application for car drivers.
As you probably know, iOS4 introduced multitasking, so our application can run in background - and it is. It's part of its functionality.
The problem is with standard method of closing applications on iOS4. Here are two scenarios:
1) User wants to put application to background:
Typically, on iPhone iOS4 it is as easy as pressing 'home' button.
2) User wants to turn application off (ie. after arriving to his destination point):
Standard iPhone iOS4 procedure is as follows:
User has to terminate our application each time he arrives somewhere (like, twice a day), to save his battery. If he does not - GPS would consume all the battery power really quickly. Also, we can't disable GPS while running in background, because we need precise location information for main application functionality.
Of course you can't change the behavior of 'home' button from your application (to be accepted to AppStore). Also I don't think it would be good solution to change expected behavior to something completely different than other applications on the iPhone platform.
What do you think about that? Do you know any good solution. We have one idea but I don't want to suggest anything to you yet.
Our idea for solution is very simple: Simply, show small 'x' button at the top right screen corner. Tapping it terminates the application (perhaps after some confirmation question).
This solution has one big advantage: it does not change default system behavior - users aware of iOS4 multitasking usage could still press 'home' button to run app in the background and close it iPhone-way.
What do you think?
Apple recommends that you do this (iPhone App Programming Guide):
Applications can register for significant location changes only. (Recommended) The significant-change location service is available in iPhone OS 4 and later for devices with a cellular radio. It offers a low-power way to receive location data and is highly recommended. New location updates are provided only when the user’s position changes significantly. If the application is suspended while running this service, new location updates will cause the application to be woken up in the background to handle them. Similarly, if the application is terminated while running this service, the system relaunches the application automatically when new location data becomes available.
Have you tried using it by calling startMonitoringSignificantLocationChanges
method of CLLocationManager?
Exiting the app should only be done as a last resort. You can turn off location services when you're not using them, without exiting the app. You can call stopUpdatingLocation
in CLLocationManager to turn it off.
- (void)stopUpdatingLocation
You should call this method whenever your code no longer needs to receive location-related events. Disabling event delivery gives the receiver the option of disabling the appropriate hardware (and thereby saving power) when no clients need location data. You can always restart the generation of location updates by calling the startUpdatingLocation method again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With