Thanks for the code example, I tried and it worked just fine.
However, I would like to know if in version 1.0 there are other ways
of reacting to an SMS and parsing its data, it seems to me a little
bit weird that there is no high level way to do this.
Have fun,
Mihai
On Sep 24, 12:21 pm, Cristina <[EMAIL PROTECTED]> wrote:
> 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 application port using 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
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---