iphone gwtphonegap地理定位始终打开
在gwtphonegap 1.7.0.0(iPhone)上,我使用地理定位服务在应用程序开始时只获取一次用户的位置iphone gwtphonegap地理定位始终打开,iphone,gwt,cordova,geolocation,Iphone,Gwt,Cordova,Geolocation,在gwtphonegap 1.7.0.0(iPhone)上,我使用地理定位服务在应用程序开始时只获取一次用户的位置 GeolocationOptions options = new GeolocationOptions(); options.setMaximumAge(1000); options.setEnableHighAccuracy(true); phoneGap.getGeolocation().getCurrentPosition(callback,
GeolocationOptions options = new GeolocationOptions();
options.setMaximumAge(1000);
options.setEnableHighAccuracy(true);
phoneGap.getGeolocation().getCurrentPosition(callback, options);
开始时只进行一次呼叫,之后不需要更新位置
问题是,当我在iPhone上运行我的应用程序时,状态栏上的GPS指示灯一直亮着,即使在我得到正确的位置之后。
这可能会导致无用的电池使用
有没有办法告诉地理定位服务在获得位置后停止?底层phonegap库似乎有。您可能需要扩展gwtphonegap。似乎我们缺少了gwtphonegap实现中的例程。我只是重新检查了一下,它们不是文档的一部分 我刚刚发布了一个关于gwt phonegap项目的问题:
作为一种解决方法,您可以直接转到jsni并直接调用start/stop方法。知道怎么做吗?我尝试了类似于
公共静态本机字符串stopGeolocation()/*-{Geolocation.prototype.stop();}-*/代码>但我不确定要调用什么方法。谢谢,这一个很好用:public静态本机字符串stopGeolocation()/*-{if(typeof$wnd.device!=“undefined”&&typeof$wnd.cordova==“object”){$wnd.cordova.exec(“Geolocation.stopLocation”);}-*/代码>