Load the iphone app automatically when phone boots

删除回忆录丶 提交于 2019-12-24 02:13:59

问题


I am doing a tracking kind of application for internal use of an organization and do not wish to submit it to app store.

What I am doing in the application is I am tracking the phone calls, messages etc.

My app runs in background once I start the app manually and keeps on running in the background until I close the app or the phone is switched off.

The thing that I want to add to my app is, I want to load the app automatically when the phone is switched on again.

Any idea or guidance will help. Suggestion for use of private apis is also welcome.


回答1:


In private api, in file SBApplication.h there are all methods that you need.

In particular:

[...]
-(BOOL) _shouldAutoLaunchOnBoot:(BOOL)boot;
-(void) autoLaunchIfNecessaryOnBoot:(BOOL)boot;
-(void) _cancelAutoRelaunch;
-(void) _relaunchAfterExit;
[...]

etc, etc...

hope this helps.




回答2:


As far as I can understand you can do it by registering your app for significant location changes. If an app registers for significant location changes, as soon as your cellular phone moves to a new tower, app receives an update. If the application is suspended when an update occurs, the system wakes it up in the background to handle the update.

So if you close the app and turn of your phone, as soon as your phone will restart it should get an update and it will force your app to run in background mode.

For more info read iOS programming guide: http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/BackgroundExecution/BackgroundExecution.html

Hope it helps



来源:https://stackoverflow.com/questions/7525171/load-the-iphone-app-automatically-when-phone-boots

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!