cordova - Rebooted android phone and the Geolocation in my phonegap application stopped working -
i rebooted android phone , geolocation code in app has stopped working. navigator.geolocation returning true getcurrentposition , watchposition aren't working. isn't returning error message either. have location turned on phone, phone version 5.0.1 , cordova version using 5.3.3.
any appreciated!
the javascript code using:
function showcurrentposition(){ if(navigator.geolocation){ navigator.geolocation.getcurrentposition(onsuccess, onerror); } } // onsuccess callback // method accepts position object, contains // current gps coordinates // var onsuccess = function(position) { alert('latitude: ' + position.coords.latitude + '\n' + 'longitude: ' + position.coords.longitude + '\n' + 'altitude: ' + position.coords.altitude + '\n' + 'accuracy: ' + position.coords.accuracy + '\n' + 'altitude accuracy: ' + position.coords.altitudeaccuracy + '\n' + 'heading: ' + position.coords.heading + '\n' + 'speed: ' + position.coords.speed + '\n' + 'timestamp: ' + position.timestamp + '\n'); }; // onerror callback receives positionerror object // function onerror() { alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n'); } console log:
the key "target-densitydpi" not supported. file:///android_asset/www/css/images/ajax-loader.gif failed load resource: net::err_file_not_found whitelist.js:23 no content-security-policy meta tag found. please add 1 when using cordova-plugin-whitelist plugin.(anonymous function) @ whitelist.js:23 index.js:41 uncaught typeerror: cannot read property 'queryselector' of null 521whitelist.js:25 no content-security-policy meta tag found. please add 1 when using cordova-plugin-whitelist plugin.
i figured out causing geolocation stop working. when rebooted android set location services gps only. when changed use wifi, phone network , gps location able obtain longitude , latitude.
the problem android phone gps has stopped working turned out hardware problem not software problem.
Comments
Post a Comment