2

I am just implementing the new Android 13 photo picker and I simply cannot get the EXIF location of the selected photos.

Intent intent = new Intent(MediaStore.ACTION_PICK_IMAGES);
intent.setType("image/*");
intent.putExtra(MediaStore.EXTRA_PICK_IMAGES_MAX, 5);
startActivityForResult(intent, SELECT_NEW_PICKER_REQUEST);

... getting the photos and checking for EXIF location:

for (int i = 0; i < returnedIntent.getClipData().getItemCount(); i++) {
    Uri uri = returnedIntent.getClipData().getItemAt(i).getUri();

    InputStream input = getContentResolver().openInputStream(uri);
    ExifInterface exifInterface = new ExifInterface(input);

    // Works! 
    String dateTime = exifInterface.getAttribute(ExifInterface.TAG_DATETIME_ORIGINAL);

    // NULL
    String latDest = exifInterface.getAttribute(ExifInterface.TAG_GPS_DEST_LATITUDE);

    // Not set
    String lat = exifInterface.getAttribute(ExifInterface.TAG_GPS_LATITUDE);

    // NULL
    double[] latLng = exifInterface.getLatLong();
}

I requested the android.permission.ACCESS_MEDIA_LOCATION and the android.permission.READ_MEDIA_IMAGES, they are both granted, but it still does not work!

Any ideas?

Tobias

UPDATE

It seems Google doesn't allow it on purpose ! https://issuetracker.google.com/issues/243294058

tobidude
  • 480
  • 1
  • 7
  • 11
  • You also need MANAGE_EXTERNAL_STORAGE. – blackapps Sep 01 '22 at 16:15
  • This permission is too much, has to works without! But I just read somewhere, that Google currently doesn’t allow it? – tobidude Sep 02 '22 at 06:09
  • You should just test if it works with that as then you know. Something diferent is publishing in play store. – blackapps Sep 02 '22 at 08:39
  • The permission MANAGE_EXTERNAL_STORAGE is not an option. It has to work without. – tobidude Sep 02 '22 at 10:50
  • https://issuetracker.google.com/issues/243294058 – tobidude Sep 02 '22 at 11:09
  • It is a pitty that you did not post here an example of such a content scheme. It would have made the problem immediately clear as its that special provider that strips the gps information at serving the file. Please do add it yet at start of your post. – blackapps Sep 02 '22 at 11:29
  • From your issue: `We will consider the location info as a feature request.` My god.. a feature! They intentionally removed the gps info. What feature! – blackapps Sep 02 '22 at 11:32

0 Answers0