Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phonegap Geolocation without WiFi and mobile network

I am developing an application using Phonegap for Android and use its geolocation method. This only works when mobile network or WiFi are available. I would like to use geolocation without these being available. Is this possible?

like image 907
tanhatarin tanha Avatar asked Nov 03 '22 21:11

tanhatarin tanha


1 Answers

If you want Android to use the GPS receiver on the device, you need to set the "enableHighAccuracy" option when setting up the watcher in you Phonegap app:

navigator.geolocation.watchPosition(onSuccess, onError, { enableHighAccuracy: true });

Then you will be able to obtain a location without relying on Wifi or mobile network.

like image 109
DaveAlden Avatar answered Nov 08 '22 04:11

DaveAlden