Save in the photo the coordinates of the place where it was taken

1

I would like in my application when taking a photo, that this photo saves the location coordinates in the details of the photo, would it be possible?

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE.);
intent.putExtra(String.valueOf(MediaStore.EXTRA_OUTPUT), uri);
startActivityForResult(intent, IMAGE_CAPTURE);

This way I call the camera, at first how to get the location I still do not know

    
asked by anonymous 17.07.2014 / 13:47

1 answer

5

Regarding the storage of data in the image:

A look at these links might help:

There is a class: ExifInterface that enables the insertion of TAGs with meta information within a image, depending on what you want to create it is worth storing this information in the image itself.

Regarding localization:

Add the following permissions to your xml manifest:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

Follow a code that gets the location in a simple way without the need to listen for a calback, anything at a Android guide to get location .

        LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        Location location = (Location) lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

        double longitude = location.getLongitude();
        double latitude = location.getLatitude();

Anything post comments, Abs.

    
17.07.2014 / 19:22