I want to fetch location from image. I have used ExifInterface. It's working in Android 9 but not working in Android 12. I have pixel 4A with Android 12. I have added access_media_location permission as well.
boolean hasLatLong = false;
if(Build.VERSION.SDK_INT>Build.VERSION_CODES.P){
InputStream stream = v.getContext().getContentResolver().openInputStream(imagePickerModel.getUri());
if (stream != null) {
ExifInterface exifInterface = new ExifInterface(stream);
stream.close();
hasLatLong= exifInterface.getLatLong() != null;
}
}else {
hasLatLong= exif.getLatLong() != null;
}