views:

51

answers:

1

I'm having some trouble accessing attributes like DURATION and DATE_MODIFIED of video and image. My app access these attributes for both type of data but if I take a picture or shoot a video the related attributes are not immediately available through content provider e.g. for DURATION for that specific video it returns 0.

If I restart the phone the attribute for the newly shoot video or picture taken becomes available.

The other way to make the attributes available is to plug in and out your phone to a computer through usb cable. Once that is done the attributes are available.

Any comments on why this is happening ?

A: 

Just to save someone the misery I had to go through. What is required is a media scan of the SDCARD to make these properties available through the content provider and android does this when the media is mounted:

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory().toString())));

Tee