sia*_*mii 5 gps android photo latitude-longitude
我在手机摄像头中启用了地理标记功能.它保存了纬度和经度信息(我已经检查过).我试着这样读
import static android.provider.MediaStore.Images.ImageColumns.*;
Uri queryPhotoUri = ...; //uri of photo
String[] photoProjection = {LATITUDE,LONGITUDE,ORIENTATION,DESCRIPTION};
Cursor photoData = getContext().getContentResolver().query(
queryPhotoUri, photoProjection, null, null, null);
int latIdx = photoData.getColumnIndex(LATITUDE);
int lngIdx = photoData.getColumnIndex(LONGITUDE);
int oriIdx = photoData.getColumnIndex(ORIENTATION);
int txtIdx = photoData.getColumnIndex(DESCRIPTION);
boolean latExists = !photoData.isNull(latIdx);
boolean lngExists = !photoData.isNull(lngIdx);
boolean oriExists = !photoData.isNull(oriIdx);
boolean txtExists = !photoData.isNull(txtIdx);
Run Code Online (Sandbox Code Playgroud)
oriExists评估为TRUE,其余为FALSE.为什么?图像内容提供商是否将纬度和经度写为照片文件的exif属性,还是将它们存储在其他位置?
此外,我正在尝试将描述写入描述列,但它没有保存.描述存储在哪里?
编辑:这变得越来越陌生.我检查了框架源代码,MediaProvider类从照片中读取exif标签并将它们存储在数据库中.但是,由于某种原因,不存储纬度和经度字段.