简体   繁体   English

科尔多瓦地理位置返回空白

[英]Cordova Geolocation returning empty

This is repeat of Apache Cordova GeoLocation not providing data 这是Apache Cordova GeoLocation不提供数据的重复

Following code returns an empty object: 以下代码返回一个空对象:

function onDeviceReady(){
    $cordovaGeolocation.getCurrentPosition({}).then(function(resp) {
      console.log(resp);
      $scope.geo.get = resp;
    });
  }

No errors or anything, just empty {} 没有错误或其他任何内容,只是空{}

Update 1 更新1

Works fine Samsung S3, but doesnt work on Nexus 4. 可以正常工作的三星S3,但不适用于Nexus 4。

Update 2 更新2

LogCat shows the following line: LogCat显示以下行:

Caught security exception registering for location updates from the system.

You need to make sure that you added the corresponding location permissions. 您需要确保添加了相应的location权限。
If you are using iOS, it might ask you if you want to allow the app to determine your location. 如果您使用的是iOS,它可能会询问您是否要允许该应用确定您的位置。

If you are not sure, check the settings on both devices (android/ios) to check the requested permissions. 如果不确定,请检查两个设备(android / ios)上的设置以检查请求的权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM