Skip to content

Chapter8 SMSNotifyExample - SMSMessage variable undefined #2

Description

@GoogleCodeExporter
(1) Problem:
    In Chapter8 SMSNotifExample, "messages" is allocated 
    but not set to pdusObj. 



(2) Source snip showing problem:
    From SMSNotifyExample.java (with my comment)

    if (bundle != null) {
                Object[] pdusObj = (Object[]) bundle.get("pdus");
                SmsMessage[] messages = new SmsMessage[pdusObj.length];

                for (SmsMessage currentMessage : messages) {


                  sb.append("Received compressed SMS\nFrom: ");

                  //Note: currentMessage not set
                  sb.append(currentMessage.getDisplayOriginatingAddress());
                  ....

                }
            }

(3) Solution:
    SmsMessage.createFromPdu need to be called before sb.append :

         currentMessage = SmsMessage.createFromPdu( 
                           (byte[]) pdusObj[index]);



Original issue reported on code.google.com by az9...@gmail.com on 23 Jun 2009 at 6:42

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions