views:

133

answers:

1

Hello

I'm developing an android application that uses the SMSManager class to send messages and am unable to get the final parameter, a pendingIntent spec'd to launch upon delivery of the SMS, to fire. I won't post actual code but example of what i'm trying to accomplish is...

THIS CODE IS EXAMPLE TO PROVE POINT ONLY

------------------- START CODE ---------------

public void randomMethodInAService(){ registerReceiver(mExampleReceiver, new IntentFilter(EXAMPLE_INTENT_STRING); Intent i = new Intent(EXAMPLE_INTENT_STRING); PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0); }

SMSManager.getDefault().sendTextMessage(address, null, sampleBody, null, pi);

final BroadcastReceiver mEXampleReceiver = new BroadcastReceiver(){ onReceiver(Context c, Intent i){ System.out.println("Anything"); } };

----- END CODE ------

In this example, I would not be able to get anything to print out. Does this intent not broadcast?

I've tested in emulators on two machines (both vista) and on a device (Moto Droid). Any hints?

A: 

Did you remember to register your receiver?

raulj