[英]Xamarin save photo with latitude and longitude
I am new to Xamarin. 我是Xamarin的新手。 I want to take a photo and write to console the latitude and longitude, where the photo was taken.
我想拍照并写信以记录照片的纬度和经度。 I'm trying to get it with the following code:
我正在尝试使用以下代码来获取它:
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");
}
And I've got Some value is equals to null
in the console. 而且我在控制台中有
Some value is equals to null
。 What am i missing? 我想念什么?
You need to add also 您还需要添加
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
in the manifest 在清单中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.