You are accessing a Content Provider and can use it's API to register notification upon changes.
Use the ContentResolver.registerContentObserver()
method from activity, and supply the base Content URI for the provider and pass true
for notifyForDescendents
parameter, and your callback will get hit every time there's a change.
getContentResolver().registerContentObserver(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, true, observer);
Pro tip: register and unregister in onResume() and onPause() respectively or you will get a crash if there are any changes while your app is not in the foreground.