2012/8/14 Nathan <[email protected]>

>
>
> On Monday, August 13, 2012 2:02:48 PM UTC-7, Kostya Vasilyev wrote:
>>
>> You are supposed to tell the media scanner about the new file yourself,
>> or else it might only be scanned after the next reboot.
>>
> How? Any example code to do that? I didn't know I would be interested in
> the media apis until now.
>

The media scanner has a utility class in the framework:

http://developer.android.com/reference/android/media/MediaScannerConnection.html

The easiest thing you can do is to call static
MediaScannerConnection.scanFile.

If you need to know when the scanning completes, you can implement
MediaScannerConnection, call connect, then call scanFile...

I have to say that making apps responsible for keeping the OS's data
structures up to date is quite a novel idea -- I guess it's due to the
limitations of the Linux kernel's file system change watching
capability.... AFAIK, it can't watch changes in sub-directories, so setting
a trigger on /mnt/sdcard in some system service won't work...

So -- you gotta do whatcha gotta do :)



>
> And does the .nomedia file matter?
>

According to the docs, it makes the media scanner ignore the directory. Not
sure if it has an effect on the scans you initiate yourself...

-- K


>
>
> Nathan
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to