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. need a good examples book with in depth

Hi Team,

 i need  a good android book  with all examples  in details  iam
new   to android . please let me  know any good book and  materials
are avilable.

-- 

2. How to make webpage in Android support input

Hi,
I want to do a web browser in my android widget,but something doesn't
run normally.
when i  visit a website which has an textbox(input type is text) in
web page in Android,  i can't input anything in
the textbox,but it can works in android own browser.Maybe i  need to
set the input access of WebView. But i don't how to make it.

-- 

3. Control System Using Android

4. Android cupcake build problems

5. Communicating between multiple Apps/Widgets?

6. Open browser in background

7. Showing a progress dialog while waiting for video buffering