Hi Justin,

Related to the problem of sending binary sms to port, I have changed
that parameter to null, and I send the data message using a port from
"5554" emulator to "5556". This seems to work looking to the log
files.

The problem is that I am not able to receive the SMS data message in
the "5556" phone. So  there must be something I am doing wrong.

In order to receive the "SMS to port" messege in "5556" I have created
a BroadcastReceiver listening to the
"android.provider.Telephony.SMS_RECEIVED" action.
I did not know how to declare the port that this receiver is listening
to...so I figured out that maybe it was declared using the port option
in the manifest..

       <receiver android:name=".ServerMessagesReceiver">
           <intent-filter>
        <action android:name="android.provider.Telephony.SMS_RECEIVED" />
        <data android:port="16001"></data>
          </intent-filter>
       </receiver>

Is this the right way to declare the port that this SMS receiver is
listening to? I suppose the problem is there....

Thanks in advance for the help

Cristina


On Oct 2, 2:32 am, "Justin (Google Employee)" <[EMAIL PROTECTED]> wrote:
> Cristina,
>
> Set the second parameter to null. The scAddress relates to the address
> of the server on the cellular network that will handle the message, it
> is not the address of the sender.
>
> Cheers,
> Justin
> Android Team @ Google
>
> On Sep 24, 5:55 am, Cristina <[EMAIL PROTECTED]> wrote:
>
>
>
> > I have just done a text to send a messege to aportusing this
>
> > SmsManager smsManager = SmsManager.getDefault();
> > shortport= 16001;
> > smsManager.sendDataMessage("5556","5554",port, "Hola".getBytes(),
> > null, null);
>
> > I use two emulators, one is launched at 5554 and the other at 5556 and
> > I try to send the binarysmsfrom 5554 to 5556.
> > In the 5556 phone I have launch an application with a
> > BroadcastReceiver in order to receiveSMSMessages (but I do not know
> > how to specify theport)
>
> > The application does not failed. But the 5556 phone does not receive
> > anything.....
> > Instead, in the console I receive the following messege every time I
> > do a try
> > [2008-09-24 14:05:06 - ddms]ADB rejected shell command (ls -l /):
>
> > Strange but it seems that the adb is receiving the request...
>
> > Does anybody has an example on how to send/receive binarySMSto an
> > applicationportusing  sendDataMessage?
>
> > On 24 sep, 14:20, "De San Nicolas Jean Philippe" <[EMAIL PROTECTED]>
> > wrote:
>
> > > Hello, I've tried your code but it failed! my application failed. Have you
> > > tried and succeed?
>
> > > 2008/9/24 Cristina <[EMAIL PROTECTED]>
>
> > > > Hi,
>
> > > > I do not know if it is the right way, but I have found a way to get
> > > > the message.
> > > > Here I include my code to get the SmsMessages. I hope it helps you
>
> > > > public class ServerMessagesReceiver extends BroadcastReceiver {
>
> > > >    static final String ACTION =
> > > > "android.provider.Telephony.SMS_RECEIVED";
>
> > > >    public void onReceive(Context context, Intent intent) {
> > > >         if (intent.getAction().equals(ACTION)) {
> > > >                 StringBuilder buf = new StringBuilder();
> > > >                 Bundle bundle = intent.getExtras();
> > > >                 if (bundle != null) {
> > > >                         Object[] pdusObj = (Object[]) 
> > > > bundle.get("pdus");
> > > >                         SmsMessage[] messages = new
> > > > SmsMessage[pdusObj.length];
> > > >                         for (int i = 0; i<pdusObj.length; i++) {
> > > >                                 messages[i] = SmsMessage.createFromPdu
> > > > ((byte[]) pdusObj[i]);
> > > >                         }
> > > > ....
> > > > ....
> > > > ...
>
> > > > By the way, Does somebody know how to receive anSMSthat has been
> > > > sent using
> > > > an applicationportusing the methos.sendDataMessage?
>
> > > > On 24 sep, 08:15, Reto Meier <[EMAIL PROTECTED]> wrote:
> > > > > Is it still possible to listen for incomingSMSmessages in the latest
> > > > > 1.0 SDK release?
>
> > > > > The SMS_RECEIVED_ACTION string used to listen for incomingSMS
> > > > > messages seems to have gone missing. It used to be available from the
> > > > > android.provider.Telephony.Smspackage, which also seems to have
> > > > > disappeared, so getMessagesFromIntent has gone too.
>
> > > > > Previously, you could create a Broadcast Receiver to listen forSMS
> > > > > messages using this code:
>
> > > > >   String incoming_SMS =
> > > > > android.provider.Telephony.Sms.Intents.SMS_RECEIVED_ACTION;
>
> > > > >   public void onReceive(Context _context, Intent _intent) {
>
> > > > >     if (_intent.getAction().equals(incoming_SMS)) {
> > > > >       SmsManagersms= SmsManager.getDefault();
> > > > >       SmsMessage[] messages =
> > > > >Sms.Intents.getMessagesFromIntent(_intent);
> > > > >     }
>
> > > > > Is there still a way to do this?
>
> > > > > Thanks
> > > > > Reto- Ocultar texto de la cita -
>
> > > - Mostrar texto de la cita -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to