Data corruption in Binary SMS

by mahantesh Hunagund » Tue, 03 Mar 2009 02:51:50 GMT


Sponsored Links
 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 "
4F b, b,  " instead of "Google".

Thanks,
Mahantesh

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. is any method where we can set icon n text?

Hi All,
is any method where we can set icon n text issingle method?
-- 
Thank's in adv.
Diya :)

--~--~---------~--~----~------------~-------~--~----~

2. OpenIntents.biz: Timesheet and PocketPlay

I'd like to introduce OpenIntents.biz - the new business web site and
partner site of OpenIntents.org:
http://www.openintents.biz/

Since our team of developers wanted to code closed source as well as
open source applications, we decided to separate them more cleanly.
All open source applications carry the "OI" in their name, while the
closed source applications don't.

The first two applications that you can buy from our website are:

* Timesheet: http://www.openintents.biz/timesheet.html  and
* PocketPlay: http://www.openintents.biz/pocketplay.html

As some of you may remember, PocketPlay actually started here in the
developer group with this post:

3. Exception is raised when remove the last item in ExpandedListView

4. Camera.PreviewCallback IOException

5. Usage of ArrayAdapter leads me to Index Array out of Bounds Exception

6. Separating ListView into Sections using Headers

7. Scrolling frustration - is this a feature or bug?