in android when video duration or date_modified attribute available through content provider
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 i开发者_Go百科f 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 ?
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())));
精彩评论