Load the iphone app automatically when phone boots

2019-07-11 18: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.

2条回答
何必那么认真
2楼-- · 2019-07-11 19:15

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.

查看更多
可以哭但决不认输i
3楼-- · 2019-07-11 19:27

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

查看更多
登录 后发表回答