【问题标题】:Xamarin save photo with latitude and longitudeXamarin 用经纬度保存照片
【发布时间】:2017-10-07 19:39:40
【问题描述】:

我是 Xamarin 的新手。我想拍张照片并写信来安慰拍摄照片的纬度和经度。我正在尝试使用以下代码获取它:

var exif = new ExifInterface(picUri.Path);
var latLong = new float[2];
float? lat = null, lng = null;
if (exif.GetLatLong(latLong))
{
    lat = latLong[0];
    lng = latLong[1];
}

if(lat != null && lng != null)
{
    Console.WriteLine("Latitue {0}, Longitude {1} ", lat, lng);
}
else
{
    Console.WriteLine("Some value is equals to null");
}

我在控制台中有Some value is equals to null。我错过了什么?

【问题讨论】:

  • 您可以搜索 Xamarin.Forms.Maps 插件。我使用我的最后一个应用程序。当设备打开 GPS 后,大约 2 秒后,找到设备位置。 i.hizliresim.com/YOrdkl.jpg

标签: c# android xamarin xamarin.android


【解决方案1】:

你还需要添加

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />

在清单中

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-18
    • 1970-01-01
    • 1970-01-01
    • 2023-04-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多