How to make Google Maps to request again for location permissions?

随声附和 提交于 2019-12-22 04:56:31

问题


I'm using Google maps in my mobile web app, but it I've noticed that sometimes when maps prompts for location permissions, users accidentally tap on "Deny" instead of "Allow" and they need to reload the page to be correctly located.

Is there a way to, i.e., have some JS call that users can trigger, let's say by tapping a button for example, to change their choice on giving location access permissions or make the browser re-prompt for them?

Thanks in advance for any help :)


回答1:


This is not possible, If the user opted out the best they can do is to clear their location settings to receive the prompt again. You can't force this, nor I believe should you want or be able to. After all where would it end.

Allow or deny? Are you sure? Sure you're sure? Positive you're sure? Etc..

See: http://support.google.com/gmm/bin/answer.py?hl=en&answer=1250068

The correct way to handle this would be to look for PERMISSION_DENIED and then display a message to your users such as "This application requires the use of location services, please enable them on your device to use this application" or some such.



来源:https://stackoverflow.com/questions/8054005/how-to-make-google-maps-to-request-again-for-location-permissions

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