【问题标题】:Storing the city or location where mobile app is used存储使用移动应用程序的城市或位置
【发布时间】:2017-09-05 18:15:45
【问题描述】:

我希望能够存储正在使用正在构建的移动应用程序的城市或位置。这将在用户登录应用程序时被跟踪。我正在阅读有关地理定位的信息,但不是很清楚。这可能吗?我正在使用 xamarin 表单。任何链接将不胜感激。

【问题讨论】:

  • 地理位置正在使用设备的 GPS 来获取用户位置的纬度/经度。然后,您将使用反向地理编码服务将其转换为实际地址。 XF 有一个地理定位器插件,可以为您完成大部分工作。
  • 你有我可以查看的例子吗?你有任何可以帮助的文档的链接吗?

标签: xamarin.forms


【解决方案1】:

请使用 CrossGeolocator

var position = await CrossGeolocator.Current.GetPositionAsync (timeoutMilliseconds: 10000);
double lat  = position.Latitude;
double long = position.Longitude;

您可以为此目的关注此 github: https://github.com/jamesmontemagno/GeolocatorPlugin


另外我建议你先申请权限。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-05
    • 2011-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多