I tried with the new API: MediaScannerConnection.scanFile(EMD.context,names,types,null);
...and it still does not add the files to the music library. Is media scanning just broken in Android 2.2??? The files are actually added to my library if I restart the phone or unmount/mount the sdcard. But in 2.1 and below, they are added to the music library immediately using the above code. Anyone got any ideas/suggestions? On Jul 7, 4:55 pm, jdeslip <jdes...@gmail.com> wrote: > I have develop and app that downloads music files and should add them > to the music library. I use the following class to do this: > > public class MediaScannerNotifier implements > MediaScannerConnectionClient { > > private Context mContext; > private MediaScannerConnection mConnection; > private String mPath; > private String mMimeType; > > public MediaScannerNotifier(Context context, String path, String > mimeType) { > mContext = context; > mPath = path; > mMimeType = mimeType; > mConnection = new MediaScannerConnection(context, this); > mConnection.connect(); > } > > public void onMediaScannerConnected() { > Log.e("SCANNER","SCAN CONNECTED"); > mConnection.scanFile(mPath, mMimeType); > } > > public void onScanCompleted(String path, Uri uri) { > Log.e("SCANNER","SCAN COMPLETED "+path+" "+uri); > mConnection.disconnect(); > mContext = null; > } > > } > > Everything works ok with android 2.1 and below. But, in android 2.2, > the media files do not get added to my music library. :( I know there > were some changes in froyo API for music scanning, but I am unsure why > the above no longer works. > > By the way, everything seems to scan fine - i.e. I get ok log messages > - E/SCANNER ( 339): SCAN COMPLETED /sdcard/EMusic/Josh Woodward/ > Breadcrumbs/TheVoices.mp3 content://media/internal/audio/media/4 > > Any idea on what to change to make media scanning work again in froyo? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en