0

I am not able to get GEO Exif infos from picture taken from camera.
This is the code, and the "oldExif" variable does have almost all values NULL (also GEO infos).

The "uri" variable is the uri of the image taken and created.

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode != AppCompatActivity.RESULT_OK) {
        return;
    }
    if (requestCode == REQUEST_IMAGE_CAPTURE) {
        try {
            if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {

                InputStream in = getContentResolver().openInputStream(uri);
                ExifInterface oldExif = new ExifInterface(in);
                // oldExif does have almost all values NULL
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

My android version is 5.0 and I already enabled the set of the camera about localization.
Indeed if I get a picture out of my app and show infos, I see geo data.

Giacomo M
  • 4,450
  • 7
  • 28
  • 57
  • If you are using `ACTION_IMAGE_CAPTURE`, there is no requirement that any of the hundreds of possible camera apps put any EXIF tags in the image. – CommonsWare Feb 08 '18 at 11:59
  • I did not write the code, but I have to update. Which ACTION I have to use to get EXIF tags? – Giacomo M Feb 08 '18 at 12:01

1 Answers1

1

There is no Intent action that:

  • Causes a third-party camera app to offer the user to take a picture, and

  • Forces that camera app to add any particular EXIF tags

Your choices are:

  • Live without the EXIF tags

  • Add those tags yourself (e.g., find the user's location and put the geotags in the image), if they are missing

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • I can do your second advise, but I did not understand if the problem depends on the device (hardware) or something else. – Giacomo M Feb 08 '18 at 12:06
  • @GiacomoMasseroniChiaro: It will depend on the camera app and the user's settings in that camera app. – CommonsWare Feb 08 '18 at 12:07