Hey All,
So i am trying to get my SMS Receiver to work, and am relatively close. I
can get the SMS, and get the PDUS value out of the intent extras, however i
am unable to get the PDUS as an object[] so that i can get the byte[]. Here
is my receiver code:
[BroadcastReceiver(Enabled = true, Label = "TRD SMS Receiver")]
[IntentFilter(new string[] { "android.provider.Telephony.SMS_RECEIVED"
})]
public class SMSReceiver : Android.Content.BroadcastReceiver
{
protected string logTag = "Zed.SMSReceiver";
public static readonly string INTENT_ACTION =
"android.provider.Telephony.SMS_RECEIVED";
public override void OnReceive(Context context, Intent intent)
{
if (intent.Action == INTENT_ACTION)
{
Bundle bundle = intent.Extras;
if (bundle != null)
{
// This value is an object[] but i can't figure out how
to get it as an object[]...
// It says that it 'Cannot convert type
Java.Lang.Object to object[]'
object[] messages = (object[])bundle.Get("pdus");
if (messages != null)
{
SmsMessage sMessage =
SmsMessage.CreateFromPdu((byte[])messages.FirstOrDefault()); //
if (sMessage != null)
{
// Do stuff
}
}
}
}
}
}
Does anyone have any thoughts??
When i debug the code in emulator, it shows that the PDUS object is an
object[] but i can't get it that way... Thanks for any help!
Regards,
Michael Gearhardt
--
View this message in context:
http://mono-for-android.1047100.n5.nabble.com/SMS-Message-Receiver-tp4903060p4903060.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