Hi,
I am trying to send binary SMS. I am using android SDK 1.0_r2. My
application is able to receive the SMS, but data I am receiving is
completely change from whatever I am sending.
Please help me in this regard.
My Code looks like
================================================
Sender
*byte[] data="Google".getBytes();*
smsManager.sendDataMessage(sendTo,scAddr,dstPort,data,sentPI,deliverPI);
===============================================================
Receiver
*public* *class* smsReceiver *extends* BroadcastReceiver {
*private* *static* *final* String *SMS_RECEIVED* =
"android.provider.Telephony.SMS_RECEIVED";
*public* *void* onReceive(Context context, Intent intent) {
*if* (intent.getAction().equals(*SMS_RECEIVED*)) {
Bundle bundle = intent.getExtras();
Object messages[] = (Object[]) bundle.get("pdus");
SmsMessage smsMessage[] = *new* SmsMessage[messages.length];
*for* (*int* n = 0; n < messages.length; n++) {
smsMessage[n] = SmsMessage.*createFromPdu*((*byte*[]) messages[n]);
}
*String str = new** String(smsMessage[0].getUserData());*
Toast toast = Toast.*makeText*(context, "Title: "+ str,Toast.*LENGTH_LONG*);
}
=========================================================================
When I checked with the help of debugger, I am receiving "
4� F���� b�X, ��b�X, " instead of "Google".
Thanks,
Mahantesh
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---