On Monday, August 13, 2012 3:18:14 PM UTC-7, Kostya Vasilyev wrote:

>
> 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.
>

Well, that requires API 8. 

Could I call 

MediaScannerConnection  conn = new MediaScannerConnection(this,null);
conn.scanfile(filepath,mimetype);

That appears to work all the way back to API 1 - but is that too easy?
 

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

Not as curious about that.  
 

> I have to say that making apps responsible for keeping the OS's data 
> structures up to date is quite a novel idea 
>
I think it is silly too - but not your fault. 
 
 

> 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...
>
 
So that is still a maybe. The documentation says that *media applications* 
ignore the directory. It doesn't say if the media scanner, which now scans 
all files, ignores it too. File explorer apps don't appear to ignore the 
path. 

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

Reply via email to