cameraview icon indicating copy to clipboard operation
cameraview copied to clipboard

Geolocation Exif

Open leonardonogueira opened this issue 6 years ago • 0 comments

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();
            }

leonardonogueira avatar Sep 04 '18 19:09 leonardonogueira