I have a compass web app which points to the clients store location, and I want to get the users geolocation permission so I can use the two locations.
I found this code in the internet, but it doesn't work in mobile browser
navigator.permissions.query({ name: 'geolocation' }).then(function(result) {
/* result.status = "prompt" */
});
navigator.geolocation.getCurrentPosition(function(result) { /* ... */ })
navigator.permissions.query({ name: 'geolocation' }).then(function(result) {
/* result.status = "granted" */
});
navigator.permissions.query({ name: 'push', userVisibleOnly:true }).then(function(result) { /* ... */ });
Your browser must support this feature
If you browser isn't exist in this list, that's mean you can't use geolocation:
https://caniuse.com/#feat=geolocation
As we see, you need use:
Opera Mobile
Chrome for Android
Firefox for Android
IE Mobile
UC Browser for Android