I haven't tried SMS, but isn't there a permission that needs to be set in the 
AndroidManifest?
Wally

> Date: Wed, 14 Sep 2011 10:33:58 -0700
> From: [email protected]
> To: [email protected]
> Subject: [mono-android] Now a Question about BroadcastReceivers not working
> 
> So I am trying to get a simple BroadcastReceiver going for handling SMS
> messages.  I have coded this out however when I deploy the app to my phone
> and then send an SMS, nothing happens.  Can someone help me spot what i am
> missing?  And is there a way to check the phone itself to see if my receiver
> is registered?
> 
>     [BroadcastReceiver(Enabled = true, Label = "SMS Receiver")]
>     [IntentFilter(new string[] { "android.provider.Telephony.SMS_RECEIVED"
> })]
>     public class SMSReceiver : Android.Content.BroadcastReceiver
>     {
>         public static readonly string INTENT_ACTION =
> "android.provider.Telephony.SMS_RECEIVED";
> 
>         public override void OnReceive(Context context, Intent intent)
>         {
>             if (intent.Action == INTENT_ACTION)
>             {
>                 StringBuilder buffer = new StringBuilder();
> 
>                 Bundle bundle = intent.Extras;
> 
>                 if (bundle != null)
>                 {
>                 }
> 
>                 NotificationManager nm =
> context.GetSystemService<NotificationManager>(Context.NotificationService);
> 
>                 nm.Notify(123, new Notification(Resource.Drawable.Icon, "SMS
> Recieved"));
>             }
>         }
>     }
> 
> --
> View this message in context: 
> http://mono-for-android.1047100.n5.nabble.com/Now-a-Question-about-BroadcastReceivers-not-working-tp4803684p4803684.html
> Sent from the Mono for Android mailing list archive at Nabble.com.
> _______________________________________________
> Monodroid mailing list
> [email protected]
> 
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
                                          
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to