Issue with Media scanner broadcast events...!
<p>I am developing an application where I am displaying gallery images for that I have used the device native gallery source code(From grep code). Everything is working fine in other devices, but I am facing the problem with the jelly bean version devices. After digging in to the problem I found one issue in the code is that it is not firing the broad cast events for media scanner.</p>

<p>Here is the code snippet:</p>

<pre><code>private void onResume()
{

    IntentFilter intentFilter = new IntentFilter(Intent.ACTION_MEDIA_MOUNTED);
    intentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
    intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_STARTED);
    intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED);
    intentFilter.addAction(Intent.ACTION_MEDIA_EJECT);
    intentFilter.addDataScheme("file");

    BroadcastReceiver mReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (action.equals(Intent.ACTION_MEDIA_MOUNTED)) {

            } else if (action.equals(Intent.ACTION_MEDIA_UNMOUNTED)) {
                // SD card unavailable
                rebake(true, false);
            } else if (action.equals(Intent.ACTION_MEDIA_SCANNER_STARTED)) {
                rebake(false, true);
            } else if (action.equals(Intent.ACTION_MEDIA_SCANNER_FINISHED)) {
                rebake(false, false);
            } else if (action.equals(Intent.ACTION_MEDIA_EJECT)) {
                rebake(true, false);
            }
        }
    };
    registerReceiver(mReceiver, intentFilter);
}
</code></pre>
