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. Problem with the heap size

Hi
I have developed an application and while running its giving heap size
problem , my application was just crashed (and not getting any
exception) ,  i saw in the DDMS that the heap size for my application
(that its my thought) is 1.316MB and i have free 336.176KB before i
start the new action, and when i start the action its crashing.

Can anyone help me to solve it... Is there any way to increase the
heap size ?
how it can be that an application will have only 1.3MB ?
Thanks !

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

2. Mobilogger project first release

Hi developers,

If you are interested in (using || testing || developing) mobile
blogging software on Android, check out Mobilogger project:

http://code.google.com/p/mobilogger/

BR,

JuhaK
--~--~---------~--~----~------------~-------~--~----~

3. When will the next version of SDK be published

4. How to "return" to an activity (Or how to terminate an activity)?

5. Deleting phone numbers and addresses

6. android stacktrace

7. debug port