Ok, I think I've figured it out. The 4th parameter (PendingIntent
sentIntent) is *not* optional. If you pass in null you get the error
log I've shown below.

Is this designed behavior? If so, it's probably worth rewording the
documentation so that it doesn't imply the parameter can be set to
null.

Caused by: java.lang.NullPointerException
    at android.os.Parcel.readException(Parcel.java:1066)
    at android.os.Parcel.readException(Parcel.java:1048)
    at com.android.internal.telephony.gsm.ISms$Stub
$Proxy.sendRawPdu(ISms.java:286)
    at android.telephony.gsm.SmsManager.sendRawPdu(SmsManager.java:
245)
    at
android.telephony.gsm.SmsManager.sendTextMessage(SmsManager.java:78)
    at com.paad.ch9test.MyActivity.onCreate(MyActivity.java:34)
    at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1084)
    at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2038)
    ... 11 more

Nice work on the inter-emulator SMS transmission by the way. Very
helpful.

Cheers
Reto

On Aug 22, 10:43 pm, "Megha Joshi" <[EMAIL PROTECTED]> wrote:
> On Fri, Aug 22, 2008 at 3:34 AM, Reto <[EMAIL PROTECTED]> wrote:
>
> > Has anyone had success sending SMS text messages in the new 0.9 beta?
>
> > The following code used to work fine, but now I'm getting a null
> > pointer exception on calling sendTextMessage:
>
> >  SmsManager smsManager = SmsManager.getDefault();
> >  String myMessage = "Android supports programmatic SMS messaging!";
> >  String sendTo = "55512345";
> >  smsManager.sendTextMessage(sendTo, null, myMessage, null, null);
>
> > I've added permissions for both SEND_SMS and WRITE_SMS in the manifest.
>
> What is the error message in logcat?
>
> Android supports sending SMS between two emulators...
> If you start two emulators and replace the sendTo string with the port
> number of the second emulator( assuming you are starting this app from first
> emulator) ...you will see SMS received notification pop up in the second
> emulator ...
>
>
>
>
--~--~---------~--~----~------------~-------~--~----~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to