I am trying to read exif tags to determine where a picture was clicked, in Android. This is the code:
ExifInterface exif = new ExifInterface(path);
float[] latlong = new float[2];
if(exif.getLatLong(latlong)) {
Log.e("DATA!!", Float.toString(latlong[0]));
Log.e("DATA!!", Float.toString(latlong[1]));
}
else
Log.e("DATA!!", "Tag data not found");
The problem is, it always goes to the else
condition. Exif never saves the location info. I checked that the GPS is on and my app has permission to access the GPS (though I don't think that's necessary). What am I missing here?
I just realized that geotagging was disabled for images. It works fine when I turned it on. Sorry for missing this.