定位数据请求
我已经组装了一个应用程序,它可以定位用户的当前位置,对当前地址进行地理编码,然后将它们放在地图上(使用谷歌地图 API),并计算出两者之间的路线。
它本身工作得很好 - 但我发现第一次在新手机或浏览器上使用它时,关于用户是否愿意共享其定位数据的初始提示会阻止它实际解析位置。
有没有办法在提示可见时暂停脚本,或者有任何其他方法可以延迟脚本或检测何时发生这种情况?
谢谢!! :)
I have put together an app which locates a user's current position, geocodes a current address and then puts them on a map (using the google maps api) with a calculated route between the two.
It works fine in itself - but I am finding that the first time using it on a new phone or browser, the initial prompt as to whether the user would like to share their positioning data or not is stopping it from actually resolving a position.
Is there a way to pause the script while that prompt is visible or any other ways I could either delay the script or detect when this has happened?
Thanks!! :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会在 onCreate 上启动一个计时器,每秒检查一次权限是否为真。或者创建一个启动位置更新的函数并在单击按钮时执行它。我不确定这是否是你的问题。
I would start a timer onCreate that checks once a second for permission to be true. Or create a function that starts location update and execute it when button is clicked. I'm not sure if that was your question though.