how can i grab incoming message from my activity ,please help? i want to grab the message variable
[BroadcastReceiver(Enabled = true, Label = "SMS Receiver")] [IntentFilter(new[] { "android.provider.Telephony.SMS_RECEIVED" })] public class SMSBroadcastReceiver : BroadcastReceiver { private const string Tag = "SMSBroadcastReceiver"; private const string IntentAction ="android.provider.Telephony.SMS_RECEIVED"; public bool Received = false; public String message = ""; public override void OnReceive(Context context, Intent intent) { Log.Info(Tag, "Intent received: " + intent.Action); if (intent.Action != IntentAction) return; var bundle = intent.Extras; if (bundle == null) return; var pdus = bundle.Get("pdus"); var castedPdus = JNIEnv.GetArray<Java.Lang.Object>(pdus.Handle); var msgs = new SmsMessage[castedPdus.Length]; var sb = new StringBuilder(); for (var i = 0; i < msgs.Length; i++) { var bytes = new byte[JNIEnv.GetArrayLength(castedPdus[i].Handle)]; JNIEnv.CopyArray(castedPdus[i].Handle, bytes); msgs[i] = SmsMessage.CreateFromPdu(bytes); sb.Append(string.Format("SMS From: {0}{1}Body:{2}{1}", msgs[i].OriginatingAddress,Environment.NewLine,msgs[i].MessageBody)); } message = sb.ToString(); Received = true; //SmsManager.Default.SendTextMessage("05383665034", null, sb.ToString(), null, null); Toast.MakeText(context, "aaaaaa:"+sb.ToString(), ToastLength.Long).Show(); } } -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/grabbing-the-message-from-smsBroadcastreceiver-tp5712977.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