Jason Robinson's answer and Sami Eltamawy answer are excelent.
Just an improvement to complete the aproach, you should use compat ExifInterface.
com.android.support:exifinterface:${lastLibVersion}
You will be able to instantiate the ExifInterface(pior API <24) with InputStream
(from ContentResolver
) instead of uri paths avoiding "File not found exceptions"
https://android-developers.googleblog.com/2016/12/introducing-the-exifinterface-support-library.html