How can I get video location data in Android?

I am trying to get metadata for video files stored on the user's phone application. I can get the file name, id, date and so on. However, latitude and longitude data is always returned as 0.0. I meant the following:

developer.android.com/reference/android/provider/MediaStore.Video.VideoColumns.html

Yes, I already allow the use of location in my settings. I have a very similar feature for images that work great.

public void getLocalVideoFiles(Context context) {
    ContentResolver videoResolver = context.getContentResolver();
    Uri videoUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
    String test = getRealPathFromURI(context, videoUri);
    Cursor videoCursor = videoResolver.query(videoUri, null, null, null, null);

    if(videoCursor!=null && videoCursor.moveToFirst()){
        //get columns
        int latColumn = videoCursor.getColumnIndex
                (MediaStore.Video.Media.LATITUDE);
        int lonColumn = videoCursor.getColumnIndex
                (MediaStore.Video.Media.LONGITUDE);

        do {
            String thisLat = Double.toString(videoCursor.getDouble(latColumn));
            String thisLon = Double.toString(videoCursor.getDouble(lonColumn));

            Log.d("video Latitude",thisLat);
            Log.d("video Longitude",thisLon);
        }
        while (videoCursor.moveToNext());
    }
    return localClips;
}

The approach described here: Geotagging the captured video gives similar results (null in the METADATA_KEY_LOCATION column).

, : Android ? , , , , . , ? , .

!

+4
1

, , Google , .

:, nexus 5 5.1, , . , , MediaStore (com.android.providers.media), SQLITE viewer

, google GeoTag. , ​​:

  • -,
  • , Video Recorder, ( FusedLocation - ). , :

    getContentResolver().update(MediaStore.Video.Media.EXTERNAL_CONTENT_URI.buildUpon().appendPath("2152").build(), cv, null, null);
    
  • ,

+2

All Articles