简体   繁体   English

以编程方式打开/关闭GPS,而无需在iPhone中提示用户

[英]Turn on/off GPS programmatically without prompting the user in iphone

I'm planning to code an application for the times when someone's iphone is lost or stolen. 我计划在某人的iphone丢失或被盗时编写应用程序代码。 So it needs to tell the location of the phone via GPS, but in case it's stolen, it wouldn't be a good idea to ask the thief to turn on the GPS. 因此,它需要通过GPS告知手机的位置,但是如果手机被盗,请小偷打开GPS并不是一个好主意。 So I'd like to know if there is a possibility of turning on/off the GPS without prompting the user. 因此,我想知道是否有可能在不提示用户的情况下打开/关闭GPS。 Thanks. 谢谢。

I'm not sure if you have seen this or not: Apple's 'find my iPhone' 我不确定您是否看过: Apple“找到我的iPhone”

Either way, The app would have to be running, with GPS enabled, for the service to work correctly. 无论哪种方式,都必须在启用GPS的情况下运行该应用程序,服务才能正常运行。 Any half-wit thief would know to quit such an application 任何机智的小偷都会知道退出这样的应用程序

You can't bypass the prompt completely. 您无法完全绕过提示。 But it won't show up forever, if the user allows the app to use location data. 但是,如果用户允许应用使用位置数据,它将不会永远显示。 Once the user allows this access twice, the app won't prompt any more. 一旦用户两次允许该访问,该应用将不再提示。 For an app like the one you describe, the user would have to do this first, and only then could future access proceed without a prompt. 对于您所描述的应用程序,用户必须首先执行此操作,然后才可以在没有提示的情况下继续进行访问。

There's still the pointer icon at the top of the screen when location services is active. 启用定位服务后,屏幕顶部仍会显示指针图标。 There's no way around that, though. 但是,没有办法解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM