Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Geolocation Exif #255

Open
leonardonogueira opened this issue Sep 4, 2018 · 0 comments
Open

Geolocation Exif #255

leonardonogueira opened this issue Sep 4, 2018 · 0 comments

Comments

@leonardonogueira
Copy link

Hi Everyone.
Is there a way to set Geolocation Exif data (ExifInterface.TAG_GPS_*) on preview time?
I could make this work on onPictureTaken, before generating the picture bitmap from the byte array, but I'd like to know if there's a better way to do this.
Let's assume the user has already allowed all the required permissions.
I saw there's a way to set the Geolocation on Camera parameters (mCamera.getParameters().setGpsLatitude), but as the camera object is private, i don't know how to to this.
Thanks a lot.

The working code i used in my case is the following:

try {
                ExifInterface exif = new ExifInterface(file.getAbsolutePath());

                exif.setAttribute(ExifInterface.TAG_GPS_LATITUDE, "******");
                exif.setAttribute(ExifInterface.TAG_GPS_LATITUDE_REF, "*");
                exif.setAttribute(ExifInterface.TAG_GPS_LONGITUDE, "******");
                exif.setAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF, "*");

                exif.saveAttributes();
            } catch (IOException e) {
                e.printStackTrace();
            }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant