geolocation – is it possible to enable or disable geo tagging feature in Android camera programmatically-ThrowExceptions

Exception or error:

I’m trying read the location from images which is taken from the camera api which I included in my project.

But

exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE)

gives null.

I know I need to enable save location(geo tagging) in settings.
But I don’t like to do that, as I need it to be done programmatically.

Is it possible to enable or disable geo tagging?

How to solve:

GPS information is not directly related to Android Camera API. The way geo tagging works is:

  • Android Camera App gets Geo Location permissions and before the capture gets the coordinates (lat, long) and either give it to camera 2 api to be added in exif of final jpeg (if using JPEG) or encode it itself into final jpeg.

Assuming you have an app that invokes camera api to capture image, what you could do is:

  • Have geo permissions in your app.
  • Invoke camera api for capturing image.
  • Once the image is returned, get coordinates from geo location
    APIs.

Use it the way you wish to.

Leave a Reply

Your email address will not be published. Required fields are marked *