[英]How to stop location services when the app is in background?
In my app I load some sites in UIWebView.在我的应用程序中,我在 UIWebView 中加载了一些网站。 Some of these sites use location services.
其中一些网站使用位置服务。
My problem is, that while viewing one of these sites, when the app goes to background, the location services are still on.我的问题是,在查看其中一个站点时,当应用程序进入后台时,位置服务仍然处于打开状态。 Since my app didn't turn them on - I don't know what to do.
由于我的应用程序没有打开它们 - 我不知道该怎么做。
The current solution I have is loading a blank page when going to background, then loading the original site back when moving to foreground.我目前的解决方案是在进入后台时加载一个空白页面,然后在移动到前台时加载原始站点。 It works, but the blank page is visible to the user, when viewing the app - which isn't very good.
它可以工作,但是在查看应用程序时,用户可以看到空白页面 - 这不是很好。
Does anyone have other ideas?有没有人有其他想法?
You can go to location services
in settings
and turn off any apps using location services.您可以 go 在
settings
中location services
并关闭任何使用定位服务的应用程序。 Mine was thumb speak that was running and sucking battery life down.我的是拇指说话,它正在运行并缩短电池寿命。
You can quit the app instead of sending in background.您可以退出应用程序而不是在后台发送。 Or you can cancel webView request when the app goes in background.
或者您可以在应用程序进入后台时取消 webView 请求。
Is it important that the app remains intact when you return from multitasking?当您从多任务处理中返回时,应用程序保持完整是否重要?
If not in 100%, I think you should try to load a blank page just when about to multitask.如果不是 100%,我认为您应该尝试在即将进行多任务处理时加载一个空白页面。
When coming back, the user might have a different location fix, so you'll need to refresh the page anyway..回来时,用户可能有不同的位置修复,所以无论如何你都需要刷新页面..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.