GetPositionAsync并不真实设备返回在室内 - Xamarin的Android [英] GetPositionAsync does not return on real device when indoors - Xamarin Android
问题描述
我正在开发和iOS和Android版本,需要使用Xamarin GPS。
I am developing both and iOS and Android version that requires GPS using Xamarin.
在iOS上它的正常工作,但是现在开发的Android版本我与GPS的一些问题。它不取GPS,但超时。然而,在一个仿真器(使用Genymotion)它取一个坐标的时候了。请注意,我现在用的是Xamarin.Mobile(最新插件0.7.5)。
On iOS it's working fine, however now developing the Android version I have some issues with the GPS. It does not fetch the GPS but times out. However, on a emulator (using Genymotion) it fetches a coordinate right away. Note that I am using the Xamarin.Mobile (latest plugin 0.7.5).
private async Task<HelpPosition> CreateGeolocator ()
{
int accuracy = SettingsManager.Instance.GetSettings ().Accuracy;
Geolocator locator = new Geolocator (this) { DesiredAccuracy = accuracy * 10 };
Position p = await locator.GetPositionAsync (timeout: 10000);
return new HelpPosition{ Latitude = p.Latitude, Longitude = p.Longitude };
}
这总是code超时10秒后。我已经设置了ACCESS_COARSE_LOCATION和ACCESS_FINE_LOCATION权限。
This always code times out after 10s. I have set the ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION permissions.
这个问题似乎只在室内时发生。不过谷歌地图是完全没有得到我的确切位置。我已经检查了位置服务(使用无线网络和使用GPS颗卫星)所有设置。该器件是一款三星注2
The issue seems only to occur when indoors. However Google Maps is perfectly fine getting my exact position. And I have checked all settings in Location Services (Use wireless networks and Use GPS satelites). The device is a Samsung Note 2.
推荐答案
从来没有Xamarin.Mobile工作满意度在Android在室内,所以我测试了组件商店avaliable唯一的其他选择:Geolocator。就像一个魅力!
Never got Xamarin.Mobile working to satisfaction on Android indoors so I tested the only other option in Component Store avaliable: Geolocator. Works like a charm!
https://components.xamarin.com/view/GeolocatorPlugin
修改它工作得更好,但即使有了这个插件,我得到的报告所收到的位置处于关闭状态。为更好的解决方案继续搜索...
Edit It works better, but even with this plugin I get reports that the location received is off. The search for a better solution continues...
这篇关于GetPositionAsync并不真实设备返回在室内 - Xamarin的Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!