Hello,

I use Android sdk 1.5 on ubuntu 8.0.4.

In my application I want to use a data sms on a special port to inform
my application about new available information. Then a background
thread should be started to process this information.

Currently i have an application sending data sms to port 12345 to an
application to another emulator. Both emulators can send and receive
sms. However there is no difference between a data sms and a text sms
in the incoming intent.

I send textSMS via:
>>...
String messageText = "Hello World";
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(<PORT-Emulator-2>, null, messageText,
                                        sentPi, deliveredPi);


and data messages via
>>...
short DATA_SMS_PORT = 12345;
String messageText = "Hello World";
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendDataMessage(<PORT-Emulator-2>, null, DATA_SMS_PORT,
                                        messageText.getBytes(), null, null);

This is the configuration of my BroadcastReceiver
<receiver android:name=".SMSReceiver">
  <intent-filter>
    <action android:name="android.provider.Telephony.SMS_RECEIVED" />
    <action android:name="android.intent.action.DATA_SMS_RECEIVED" />
        <data android:port="12345"/>
    </intent-filter>
</receiver>

and a litte source code:
public void onReceive(Context context, Intent intent) {
  ...
                StringBuilder sb = new StringBuilder();
                Bundle bundle = intent.getExtras();
                Log.d(LOGTAG, intent.toString());

                        SmsMessage[] messages = new SmsMessage[pdusObj.length];
                        for (int i = 0; i < pdusObj.length; i++) {
                                messages[i] = SmsMessage.createFromPdu((byte[]) 
pdusObj[i]);
                        }

                        for (SmsMessage currentMessage : messages) {
                                sb.append("SMS From: ");
                                
sb.append(currentMessage.getDisplayOriginatingAddress());
                        }
                        Toast t = Toast.makeText(context, sb, 
Toast.LENGTH_LONG);
                        t.show();
                }
  ...
}

Whatever method i take to send the sms, I always receive a text sms.
When i log the "intent.toString()" it always returns
Intent {
        action=android.provider.Telephony.SMS_RECEIVED
        comp={de.mySms/de.mySms.SMSReceiver}
        (has extras)
}
I see no possibility to use a intent-filter receiving data-sms
("android.intent.action.DATA_SMS_RECEIVED").

a) can anyone help me here? Is there a possibility to send AND receive
a data sms to a special application port from within the emulator?
b) Can i send, receive data sms from the G1?
c) Is this a known issue?

Any help is welcome.
Greetings Andy



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to