My phone camera has geometry turned on. It stores information about latitude and longitude (I checked). I'm trying to read it like this
import static android.provider.MediaStore.Images.ImageColumns.*;
Uri queryPhotoUri = ...;
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);
oriExists evaluates to TRUE, the rest is FALSE. What for? Does the image content provider provide latitude and longitude as an exif attribute for a photo file, or save it somewhere else?
In addition, I am trying to write a description of the photo in the DESCRIPTION column, but it is not saved. Where is the description stored?
Edit: This is getting weird. I checked the source of the framework, and the MediaProvider class reads exif tags from the photo and stores them in the database. However, the latitude and longitude fields for some reason are not saved.