Can we restart an app programmatically in ios when the phone is turned on [closed]

余生长醉 提交于 2020-01-14 05:25:50

问题


We have an app that runs in the background, which calls an URL every 15 minutes, but when the phone is turned off and turned on, we want to open the app automatically and resume calling the URL, is this possible???

This is an app that gives a local notification to the user that a website content has changed, when the content has been changed by the admin, that is the reason...

i think this is possible for location services and voip, but what are the conditions before we do this and how to do this?

any help will be much appreciated, thanks in advance...


回答1:


There is a way to do this intended for voip apps by setting your app's UIBackgroundMode to include the voip value. See the Apple Documentation on that for more info, but here is the excerpt about what the voip flag does for you:

The app provides Voice-over-IP services. Apps with this key are automatically launched after system boot so that the app can reestablish VoIP services. Apps with this key are also allowed to play background audio.

If your app is a voip app, then this is what you need. If your app is not a voip app I don't know if this change will make it past Apple's review since that flag is really meant for voip apps.




回答2:


use location services and the app is kept running and is restarted so as to get location infos (but be aware that this drains battery and will not be liked by apple/users :D)

[[CLLocationManager sharedManager] startMonitoringSignificantLocationChanges];



来源:https://stackoverflow.com/questions/20841360/can-we-restart-an-app-programmatically-in-ios-when-the-phone-is-turned-on

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