views:

35

answers:

2

I have developed an application for iPhone that runs in the background with GPS mode on. I need to ask the server if there are any new tasks for the user? Fir this purpose, I have added the code in the didUpdateToLocation method. Now the problem is that it consumes the battery very fast. Please guide me how to avoid the battery consumption. Also, I need to keep the location accuracy at best. Also, is there any other way where I can communicate to the server even while the app is running in the background. Please help me, I will be really grateful.

A: 

It is impossible to get accurate location without using internal GPS in the current state of iPhone. Since essentially you are keeping the GPS alive during the running of the app (not sure if Multitasking API allows GPS calling in background though), it would consume lots of battery power without doubt.

In this case, you either have to avoid calling GPS as much, or live with coarse locations from the cellar towers. You can't have both frequent GPS results and nice battery consumption.

itsnotvalid
A: 

GPS is not available for suspended applications. They can use location tracking based on cell tower triangulation or WiFi spots. So you will not receive a "best" accurate signal.

The options for applications running in suspended mode are limited. Basically you can play music, do basic location tracking and finish things you are doing (e.g. a file download). You will not be able to call new methods yourself. Especially you cannot initiate a new connection to a server and poll or send data regularly.

muffix