GlassMusicPlayer
GlassMusicPlayer copied to clipboard
doesn't find my music
I just installed the apk, and then pushed a bunch of mp3's into /sdcard/Music -- but it comes up with No Music Found.
Try putting them into a different folder. If that doesn't work, can you possibly download the source and run it and see what error it gives? I can think of multiple issues that it can possibly be, but its hard to tell.
Kenny, thanks for the quick reply.
It looks like it will actually find them in any folder eventually. I think what's missing might be a ContentObserver registered with the cursor, so that it updates when files are added. It seems like the way it's set up now it doesn't rescan until you actually kill the application. At the moment pressing Stop doesn't actually stop the application -- I see that you call stopService but something is causing that to not actually stop, because I can see over adb that the process is still running. So that should probably be corrected either way, but it won't be as important as far as getting new songs to show up once there's a ContentObserver. I'll play around with it if I have time and send you a PR if I get it working.
The media scanner is finicky at times. Restarting the device usually will get it to pick up the files. I'll look into the service not being stopped.
Alright I tried a whole bunch of stuff. It seems like there is nothing that can persuade the media scanner to pick up a new file even if I give it the name. I tried using a broadcast intent
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,
Uri.fromFile(new File(MUSIC_PATH + "/" +path))));
Logcat even shows that it's received
187 366-366/? D/MediaScannerReceiver﹕ action: android.intent.action.MEDIA_SCANNER_SCAN_FILE path: /sdcard/Music/06 Satisfaction.mp3
But it still doesn't get into the cursor
I also tried explicitly including the code
MediaScannerConnection.scanFile(
getApplicationContext(),
new String[]{MUSIC_PATH + "/" + path },
null,
new MediaScannerConnection.MediaScannerConnectionClient()
{
public void onMediaScannerConnected()
{
Log.v(TAG, "Loading song: Scanning the new song");
}
public void onScanCompleted(String path, Uri uri)
{
loadSongs();
}
});
But the callbacks never get called.