开发者

iPhone background network connection by timer

I need to write an application, that every 10 minutes it should be awaken from suspended mode, get user location via gps and send this information to the server by network.

Depending on the response it should return to the suspended mode or show local notifica开发者_C百科tion to the user.

Is there a way to do this on iOS 4? I've tried different approaches, but the only working for me was to start monitoring user location in backgroind and declare the application as location background application. In that case it worked in background and has a network connection. But this approach takes a lot of power and not accepted cause application should work 24/7.

May be there is a way to write some daemon that should work in background and wake my application every 10 minutes?


Apparently, Pastebot tried to do something similar with the 'audio' multitasking declaration (by playing a silent audiofile) and got rejected.. UNTIL they actually presented a option to the user to pick which audiofile they wanted to play. It's in the appstore now. :)

In this case: What is your reason for not wanting to use the location updates? If battery-usage is a concern, you can use the 'significant location changes only' option, after which you can temporarily change to a more accurate option.


This isn't possible outside of the method you have already tried.

The iPhone background task API will allow you to run a location service in the background.

There is no way to write daemons for the iPhone without jailbreaking, and that is not something I'm able/prepared to help you with.


App store friendly: use new APIs in iOS4, which allows u to make use of GPS location

Anti App store: create a daemon by adding a specific plist file to System/Library/LaunchDaemons/ and put ur app under Applications/. this approach requires a jailbroken iPhone however...

detailed information plz google the following keywords: daemon, multitask, background, etc...

cheers, Lloyd

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜