I thought this, "
[IntentFilter(new[] { "android.provider.Telephony. SMS_RECEIVED" })] " was the same as registering the recvr in manifest, which makes it where you don't have to call register recvr? Second, do you have any other sms recving apps on the emulator that could be suppressing it? On Wed, Aug 29, 2012 at 5:33 AM, sorniels <sorni...@fooz.dk> wrote: > This doesn't work for me. I have the following: > > [BroadcastReceiver(Enabled = true)] > [IntentFilter(new[] { "android.provider.Telephony.SMS_RECEIVED" })] > public class TextMessageListener : BroadcastReceiver > { > public static readonly string IntentAction = > "android.provider.Telephony.SMS_RECEIVED"; > > public override void OnReceive(Context context, Intent intent) > { > Toast.MakeText(context, "Msg received!", > ToastLength.Short).Show(); > if (intent.Action == IntentAction) > { > var bundle = intent.Extras; > > if (bundle != null) > { > var pdus = bundle.Get ("pdus"); > var castedPdus = > JNIEnv.GetArray<Java.Lang.Object>(pdus.Handle); > > var bytes = new > Byte[JNIEnv.GetArrayLength(castedPdus[0].Handle)]; > JNIEnv.CopyArray(castedPdus[0].Handle, bytes); > var message = Encoding.UTF8.GetString(bytes); > ((Main)context).ShowMessage(message); > } > } > } > } > > In the OnCreate() of my Main activity I'm registering the BroadcastReceiver > like this: > > _receiver = new TextMessageListener(); > var intent = new IntentFilter(); > intent.AddAction(TextMessageListener.IntentAction); > RegisterReceiver(_receiver, intent); > > Receive Sms is added to the manifest as a permission. The problem is, that > the SMS_RECEIVED never seems to fire. I've had a breakpoint in the code, > but > it never reaches it. > > > > -- > View this message in context: > http://mono-for-android.1047100.n5.nabble.com/Handle-incoming-SMS-tp5711524p5711623.html > Sent from the Mono for Android mailing list archive at Nabble.com. > _______________________________________________ > Monodroid mailing list > Monodroid@lists.ximian.com > > UNSUBSCRIBE INFORMATION: > http://lists.ximian.com/mailman/listinfo/monodroid > -- Extreme Knowledge is not something for which he programs a computer but for which his computer is programming him. -Wozniak - if my programming advice has helped you, feel free to donate to : <https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KYUXV2PG88YQQ> <https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KYUXV2PG88YQQ> <https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KYUXV2PG88YQQ>
_______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid