重新启动android手机,我的phonegap应用程序中的地理位置停止工作

重新启动android手机,我的phonegap应用程序中的地理位置停止工作,android,cordova,plugins,geolocation,Android,Cordova,Plugins,Geolocation,我重新启动了我的android手机,我应用程序中的地理位置代码已经停止工作。navigator.geolocation返回true,但getCurrentPosition和watchPosition不工作。它也不会返回错误消息。我打开了手机,手机版本是5.0.1,我使用的cordova版本是5.3.3 任何帮助都将不胜感激 我正在使用的JavaScript代码: function showCurrentPosition(){ if(navigator.geolocation){

我重新启动了我的android手机,我应用程序中的地理位置代码已经停止工作。
navigator.geolocation
返回true,但
getCurrentPosition
watchPosition
不工作。它也不会返回错误消息。我打开了手机,手机版本是5.0.1,我使用的cordova版本是5.3.3

任何帮助都将不胜感激

我正在使用的JavaScript代码:

function showCurrentPosition(){
    if(navigator.geolocation){
        navigator.geolocation.getCurrentPosition(onSuccess, onError);
    }
}


// onSuccess Callback
// This method accepts a Position object, which contains the
// 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 a PositionError object
//
function onError() {
    alert('code: '    + error.code    + '\n' +
          'message: ' + error.message + '\n');
}
控制台日志:

The key "target-densitydpi" is not supported.
file:///android_asset/www/css/images/ajax-loader.gif Failed to load resource: net::ERR_FILE_NOT_FOUND
whitelist.js:23 No Content-Security-Policy meta tag found. Please add one when using the 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 one when using the cordova-plugin-whitelist plugin.

我找到了导致我的地理位置停止工作的原因。当我重新启动android时,定位服务设置为仅GPS。当我改变它使用无线网络,电话网络和GPS为我的位置,它能够获得我的经度和纬度


我的android手机的问题是GPS已经停止工作,所以这是硬件问题而不是软件问题。

我找到了导致我的地理位置停止工作的原因。当我重新启动android时,定位服务设置为仅GPS。当我改变它使用无线网络,电话网络和GPS为我的位置,它能够获得我的经度和纬度


我的android手机的问题是GPS已经停止工作,所以这是硬件问题而不是软件问题。

如果您在问题中包含GPS抛出的错误,您将有更好的机会获得帮助。你能复制堆栈跟踪并编辑你的问题以包含它吗?@FoamyGuy我已经更新了这个问题,并从google chrome webview添加到控制台日志中。我已经让sqlite数据库工作了,但是我看不出是什么阻止了地理定位的工作,尽管你知道吗?系统已经意识到插件在那里,但是函数get和watch position由于某些原因无法工作。如果您在问题中包含插件抛出的错误,您将有更好的机会获得帮助。你能复制堆栈跟踪并编辑你的问题以包含它吗?@FoamyGuy我已经更新了这个问题,并从google chrome webview添加到控制台日志中。我已经让sqlite数据库工作了,但是我看不出是什么阻止了地理定位的工作,尽管你知道吗?系统正在识别插件,但是函数get和watch position由于某种原因无法工作。