hi all can someone suggest an alternative to location sensor , i have tried many extensions but all of them are very slow
i found a script on w3schools to get location , can i run this is app inventor somehow
<!DOCTYPE html>
<html>
<body>
<p>Click the button to get your coordinates.</p>
<button onclick="getLocation()">Try It</button>
<p id="demo"></p>
<script>
var x = document.getElementById("demo");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
x.innerHTML = "Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}
</script>
</body>
</html>
the html code? the problem is that the location sensor is too slow and i want to get coordinates from location sensor but it takes upto 1 minute thats why i was finding a alternative i tried many extensions but they are too slow
If you use the gps receiver, the receiver MUST get a satellite fix. The initial fix may take 30 to 60 seconds; subsequent fixes will take about 20 seconds or less depending on many factors.
The html file does work in the webviewer, asks user for permission to access Location (Location services need to be ON) No reason why this method would be any quicker than built-in blocks / component method, so may as well use the built in method.
You could try something like this that uses WIFI/network instead of the gps receiver hardware.
If you are WIFI connected, it should provide an instantaneous location response.
This works on my 4.2 phone with passive provider. It might also work with network provider. It does not work with my 8.1 Android.
Be sure to unlock the Provider when you are finished experimenting.