Some Android devices have the problem of not being able to obtain the user’s current geolocation using the following standard code:navigator.geolocation.getCurrentPosition(onSuccess, onError, options);
The first possible solution to this problem is to add the following options parameter:options = { enableHighAccuracy: true,timeout: 5000,maximumAge: 0,desiredAccuracy: 0, frequency: 1 };
If that doesn’t work, the other possible solution is to stop using getCurrentPosition and start using the following:
var watchID = null;
if (navigator.geolocation) {
watchID = navigator.geolocation.watchPosition(
function showPosition(position{
navigator.geolocation.clearWatch(watchID);
},
function showError(error) { },
{ enableHighAccuracy: true,timeout: 5000,maximumAge: 0,
desiredAccuracy: 0, frequency: 1 }
);
}
Posted in Android, Mobile, Software Development
By infuy
Infuy is an international technology leader company specialized in outsourcing services in the latest technologies. Blockchain (smart contracts, dApps and NFT marketplaces), full-stack, mobile development, and team augmentation are some of the areas where Infuy specializes in.
As a software development company based in Uruguay with offices in the US, Infuy is always looking for the next big challenge, and the next big partner.
As a fast-growing company, Infuy is always looking for talented and proactive people, who live up to the challenge and are as passionate as their team is about their mission to provide the best solutions to their partners, with the latest technologies, to join the team.
For more information about the company and its services, please visit https://www.infuy.com/.