【问题标题】:Ripple geolocation settings being ignored by Cordova applicationCordova 应用程序忽略波纹地理定位设置
【发布时间】:2015-04-24 23:56:01
【问题描述】:

我正在使用 Visual Studio 2013 Update 4,并且我已经安装了 Visual Studio for Cordova 插件(版本 0.3.22015.1)。

我创建了一个基于 Ionic SideMenu Starter Template for Cordova 示例的基于 Angular 的应用程序。我在 config.xml 文件中包含了 Cordova 地理定位插件。

在此示例中,我使用以下代码获取设备的位置:

$scope.showPosition = function (position) {
 // ...
}

$scope.getLocation = function () {
 if (navigator.geolocation) {
  navigator.geolocation.getCurrentPosition($scope.showPosition, $scope.showError);
 }
 else {
  $scope.error = "Geolocation is not supported by this browser.";
 }
}

执行此代码时,我希望传递给 showPosition 回调的位置对象具有在 Ripple 模拟器中指定的模拟地理位置值。但是我没有得到这些模拟值,我得到了我的实际位置。

如何让我的代码使用模拟值?

【问题讨论】:

    标签: cordova gps cordova-plugins visual-studio-cordova ripple


    【解决方案1】:

    不幸的是,这是 Ripple 本身的一个错误。好消息是周三刚刚发布了一个修复程序。 https://github.com/apache/incubator-ripple/blob/master/doc/CHANGELOG.md

    您可以在 VS 2013 中通过打开命令命令提示符并键入以下内容来修补 Ripple:

    cd %appdata%\npm\node_modules\vs-mda
    npm install ripple-emulator@0.9.29 --save
    

    对于 VS 2015:

    cd %appdata%\npm\node_modules\vs-tac
    npm install ripple-emulator@0.9.29 --save
    

    如果您清除 Cordova 缓存,则需要再次执行此操作。

    【讨论】:

    • 嗨查克。我成功运行了补丁。但是,当我现在在 VS 2013 中运行我的应用程序时,我没有成功将应用程序上传到我的 Android 设备,而是收到错误“错误:DEP10201:无法部署到设备,未找到设备”。从这里抛出“\bld\Debug\platforms\android\cordova\node_modules\q\q.js:126”。关于如何解决这个问题的任何想法?
    • 原来我需要为我的手机重新安装ADB USB驱动程序,这很可能是与更新ripple有关的问题。对于那些处于类似情况的人,可以在此处找到有关更新 ADB 驱动程序的好指南teamandroid.com/2012/07/30/…
    猜你喜欢
    • 2014-10-28
    • 2017-03-05
    • 1970-01-01
    • 2012-08-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多