- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
工作灯 6.2.0.00-20120814-0824
位置代码在浏览器模拟器中运行良好,但在 Android 模拟器中失败,成功或失败回调均未触发。
Logcat 显示:
10-06 16:00:40.707:W/PluginManager(3193):线程警告:对 WLGeolocationPlugin.getLocation 的 exec() 调用阻塞了主线程 75 毫秒。插件应该使用 CordovaInterface.getThreadPool()。
代码:
var showPosition = function(position) {
WL.Logger.debug("got a position");
var latitude = Number(position.coords.latitude).toFixed(2);
var longitude = Number(position.coords.longitude).toFixed(2);
$("#currentLocation").text(latitude + " / " + longitude);
};
var positionError = function(err) {
WL.Logger.debug("failed to get a position");
$("#status").text("position error" + err);
};
var geoPolicy = WL.Device.Geo.Profiles.RoughTracking(); // other profiles tried, same result
WL.Device.Geo.acquirePosition(showPosition, positionError, geoPolicy);
Android list 有
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
在我添加那些之前我有不同的错误条件,表明权限错误,所以我认为权限现在是正确的。
--------编辑以添加更多信息----
我已经部署到真实的 Android 设备,但仍然没有触发任何回调。我确实在 LogCat 中看到了这些消息,表明 Worklight 正在使用 gps 做一些事情,但就我的代码而言没有提供答案
GC_FOR_ALLOC freed 738K, 11% free 10956K/12200K, paused 38ms, total 38ms
[ 10-07 15:30:21.656 13319:13340 D/com.worklight.androidgap.plugin.WLLocationListener ]
WLLocationListener.onLocationChanged in WLLocationListener.java:174 :: The location has been updated!
[ 10-07 15:30:21.661 13319:13340 D/com.worklight.androidgap.plugin.WLLocationListener ]
WLLocationListener.win in WLLocationListener.java:100 :: Acquired location age: 178 milliseconds. More than maximumAge of 100 milliseconds. Ignoring.
[ 10-07 15:30:21.661 13319:13340 D/com.worklight.androidgap.plugin.WLLocationListener ]
WLLocationListener.onStatusChanged in WLLocationListener.java:156 :: The status of the provider gps has changed
[ 10-07 15:30:21.666 13319:13340 D/com.worklight.androidgap.plugin.WLLocationListener ]
WLLocationListener.onStatusChanged in WLLocationListener.java:162 :: gps is TEMPORARILY_UNAVAILABLE
[ 10-07 15:30:21.686 546: 549 D/dalvikvm ]
GC_CONCURRENT freed 432K, 6% free 10266K/10920K, paused 1ms+1ms, total 15ms
[ 10-07 15:30:21.686 546:12382 D/dalvikvm ]
WAIT_FOR_CONCURRENT_GC blocked 9ms
[ 10-07 15:55:05.761 13671:13695 D/com.worklight.androidgap.plugin.WLLocationListener ]
WLLocationListener.win in WLLocationListener.java:100 :: Acquired location age: 170 milliseconds. More than maximumAge of 100 milliseconds. Ignoring.
[ 10-07 15:55:05.791 13671:13695 D/dalvikvm ]
GC_FOR_ALLOC freed 530K, 9% free 10268K/11252K, paused 22ms, total 22ms
[ 10-07 15:55:05.791 13671:13695 D/com.worklight.androidgap.plugin.WLLocationListener ]
WLLocationListener.onStatusChanged in WLLocationListener.java:156 :: The status of the provider gps has changed
[ 10-07 15:55:05.796 13671:13695 D/com.worklight.androidgap.plugin.WLLocationListener ]
WLLocationListener.onStatusChanged in WLLocationListener.java:162 :: gps is TEMPORARILY_UNAVAILABLE
[ 10-07 15:55:06.366 13671:13695 D/NONE ]
navigator :: back pages/home.html
[ 10-07 15:55:08.406 13671:13695 D/NONE ]
navigator :: loadPage :: myProfile
[ 10-07 15:55:08.431 13671:13695 D/NONE ]
myProfile :: buildDepartmentList Art and Architecture,Billing And Accounts,Claims
[ 10-07 15:55:08.441 13671:13695 D/NONE ]
myProfile :: myProfileInit fetch acquire pos
[ 10-07 15:55:21.741 365: 568 D/libgps ]
proxy_gps_status_cb: called. status(4)
[ 10-07 15:55:21.741 365: 568 D/libgps ]
proxy_gps_status_cb: normal GPS icon mode.
[ 10-07 15:55:21.746 365: 568 I/libgps ]
disarming wakeLockTimer
[ 10-07 15:55:21.746 365: 568 I/libgps ]
[proxy_gps_release_wakelock_cb][line = 653]: release_wakelock(0)
最佳答案
答案似乎是我需要指定一个 maximumAge 选项
var geoPolicy = WL.Device.Geo.Profiles.RoughTracking(); // other profiles tried, same result
geoPolicy.maximumAge = 5000;
WL.Device.Geo.acquirePosition(showPosition, positionError, geoPolicy);
日志(如上所示)表明获得了一个答案,但根据其年龄将其丢弃。似乎我需要指定 maximumAge 大于获得职位所花费的时间。
关于android - Geolocation Plugin.geoLocation 在模拟器或设备上没有给出答案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26220362/
尝试熟悉 Maven 并参加在线类(class),但陷入困境......感谢提供的任何帮助。 我正在运行站点阶段,虽然它已完成并且我能够在浏览器中实际查看index.html,但我在此过程中遇到了很多
基本上就是标题。。我在任何地方都找不到一个简单的比较,来解释这两者之间的差异:。我知道Gradle中可以有3种类型的插件:。我认为这三种类型的插件在某种程度上与它们可以在settings.gradle
我是 maven 的初学者,现在我对这些 maven 插件之间的区别感到困惑。这些都是创建jar文件吗?现在我的问题是 各个插件创建的jar有什么区别。(组装插件、jar-plugin、shaded插
我使用 tycho-packaging-plugin 来设置 jar 的输出文件夹。这是我的 pom 的缩短版本: 0.21.0 org.eclipse.
When starting the server, refuses to load my plugin with an error:启动服务器时,拒绝加载我的插件,并出现错误: Could n
为什么卸载以下(空)插件会导致错误? 这是my-plugin/my-plugin.php : : my-plugin 关于wordpress - 由于错误 : Could not fully remo
我使用 sbt 与 playframework 和 activator 来构建一个 Web 应用程序。我的 sbt 版本是 0.13.0 我将plugin.sbt 文件更改为: logLevel :=
这是我运行 atlas-create-jira-plugin 时得到的结果后跟 atlas-create-jira-plugin-module选择选项1: Component Import . 问题是
我正在尝试使用 Maven 构建我的 Java 项目,但它失败了,并且出现以下错误: 从存储库 [local (C:\Users\Vinita.Gupta.m2\repository), centra
我正在使用 eclipse mars-2。我想在 Windows 中创建一个新的 Maven Spring Boot 项目。但我遇到了类似 的错误 Could not calculate build
最近开发的产品,我们是有四五个maven模块,开发阶段一直是在eclipse中运行的,然后快发版的时候,需要把这些项目打成jar包,通过命令去启动,那首先就得把这些模块项目打包,或者拷贝一些资源文件等
我想使用 maven-resources-plugin 复制 Excel 并使用 exec-maven-plugin 从该 Excel 创建一些属性文件。并且新创建的属性需要附加到构建中。我可以创建属
当我尝试构建项目时出现此错误。 Errors occurred during the build. Errors running builder 'Maven Project Builder' on
当我在执行 Maven 时从 eclipse 内部 -> 更新项目我遇到以下问题 Unable to update Maven configuration Could not calculate bu
我之前问过一个关于延迟处理事件的问题:Grails non time based queuing .我开始使用 rabbitmq 插件:http://grails.org/plugin/rabbitm
我正在尝试使用 maven 构建一个 java spring 项目(来自 heroku 入门指南的默认项目)。出于某种原因,我不断收到以下错误。机器上网应该没有问题。 Failed to execut
操作系统:OSX 10.11 Cordova :5.4.1(也尝试过 6.0)节点:4.2.6使用的cordova插件:crosswalk-project/cordova-plugin-crosswa
org.sonatype.maven.plugin :emma-maven-plugin:1.2 org.codehaus.mojo :emma-maven-plugin:1.0-alpha-3 or
我正在管理安装了很多插件的多个 shopware 6 商店。后端只允许更新一个插件,这非常耗时,因为更新分两步完成: 更新已加载(加载器圈) 后端已重新加载(html 重新加载) 为什么没有“更新所有
我正在管理安装了很多插件的多个 shopware 6 商店。后端只允许更新一个插件,这非常耗时,因为更新分两步完成: 更新已加载(加载器圈) 后端已重新加载(html 重新加载) 为什么没有“更新所有
我是一名优秀的程序员,十分优秀!