If the source code is any indicator, you need:
intentFilter.addDataScheme("file");
or the <data> equivalent in addition to what you have there. For example:
IntentFilter intentFilter =
new IntentFilter(Intent.ACTION_MEDIA_SCANNER_FINISHED);
intentFilter.addDataScheme("file");
registerReceiver(mReceiver, intentFilter);
On Wed, Dec 15, 2010 at 7:17 PM, Julius Spencer <[email protected]> wrote:
> Hi,
>
> I have set up a BroadcastReceiver to capture:
> Intent.ACTION_MEDIA_SCANNER_FINISHED
> or:
> "android.intent.action.MEDIA_SCANNER_FINISHED"
>
> and I'm not able to capture the Intent.
>
> I have tried using the Manifest as well as programmatically, without any luck:
>
> <receiver android:name=".MediaScannerFinishedReceiver">
> <intent-filter>
> <action
> android:name="android.intent.action.MEDIA_SCANNER_FINISHED"/>
> </intent-filter>
> </receiver>
>
> or:
>
> public void registerMediaScannerListener() {
> if (mMediaScannerReceiver == null) {
> mMediaScannerReceiver = new BroadcastReceiver() {
> �...@override
> public void onReceive(Context context, Intent
> intent) {
> String action = intent.getAction();
> if
> (action.equals(Intent.ACTION_MEDIA_SCANNER_FINISHED)) {
> System.out.println("I'm
> here!");
> }
> }
> };
> IntentFilter iFilter = new IntentFilter();
>
> iFilter.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED);
> registerReceiver(mMediaScannerReceiver, iFilter);
> }
> }
>
>
> Has anyone tried this - is there a permission or something I need to capture
> this?
>
> Thank you for any help!
>
> Regards,
> Julius.
>
>
> Regards,
> Julius Spencer.
>
> [email protected]
> Ph: 0064 9 307 1089
> Fax: 0064 9 307 5281
> Mobile: 0064 21 72 5559
>
> --
> 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
>
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy
_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
Available!
--
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