On Thu, Jun 4, 2009 at 3:44 AM, CodePupil <[email protected]> wrote:
>
> Hi,
>
> I'm trying to receive Android's Broadcast message say
> MEDIA_SCANNER_FINISHED, but not able to do so.
> Here is my code snippet:
>
> public class MyBroadcastRec extends BroadcastReceiver
> {
> MyActivityClass receiver;
> private final static String TAG = "MyBroadcastRec";
> MyBroadcastRec(MyActivityClass cntxt)
> {
> receiver = cntxt;
> }
> @Override
> public void onReceive(Context context, Intent intent)
> {
> String inte = intent.getAction();
> if( inte.equals(Intent.ACTION_MEDIA_SCANNER_FINISHED))
> {
> receiver.reportMediascannerEvent(); // calling
> MyActivityClass' method
> }
>
>
> }
> }
>
> I'm instantiating MyBroadcastRec class inside MyActivityClass.
> here onReceive() method should be called as soon as MediaScanner
> finishes but it's not getting called.
Are you sure the media scanner was actually doing something?
I've tried with both, by mentioning receiver class in manifest.xml
> file and by using registerReceiver() function.
> Could anybody tell what's wrong with that ?
I don't see anything obviously wrong with the code you posted, so the
problem must be with the way you register the receiver. Post more code.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---