Android how to access the location data in a jpg

Todd Davies picture Todd Davies · Jun 7, 2012 · Viewed 19.8k times · Source

I'm making an Android app that includes a feature to show images on a map.

How can I extract the location data from a .jpg file (if there is location data)?

Many thanks, Todd.

Answer

Bo. picture Bo. · Jun 7, 2012

There is nice tutorial how to access exif data (that includes GPS info you need) from jpg that can help you:
http://android-coding.blogspot.com/2011/10/read-exif-of-jpg-file-using.html

The corresponding class is described in official docs:
http://developer.android.com/reference/android/media/ExifInterface.html

Also useful post (convert GPS info) can be found:
http://android-coding.blogspot.com/2011/10/convert-gps-tag-of-exifinterface-to.html