Hi,

Please note that there is no longer any class called IntentReceiver.
It is now called BroadcastReceiver. Also, to get this to work, you
need to register the receiver in the AndroidManifest.xml like this:

        <receiver android:name=".RespToSMS">
                <intent-filter>
                        <action 
android:name="android.provider.Telephony.SMS_RECEIVED" />
                </intent-filter>
        </receiver>

Regards,
Andreas

On Mar 18, 2:50 pm, Vaibhav Kulkarni <[email protected]> wrote:
> Hi Sam,
>
> I think you should create a service for that!!! You can use Intent for SMS
> in following way
>
> public class RespToSMS extends IntentReceiver {
>     /* package name for Intent */
>     static final String ACTION =
>          "android.provider.Telephony.SMS_RECEIVED";
>
>     public void onReceiveIntent(Context context, Intent intent) {
>      if (intent.getAction().equals(ACTION)) {
>           StringBuilder buf = new StringBuilder();
>          Bundle bundle = intent.getExtras();
>           if (bundle != null) {
>           SmsMessage[] messages =
> Telephony.Sms.Intents.getMessagesFromIntent(intent);
>           for (int i = 0; i &lt; messages.length; i++) {
>               SmsMessage message = messages[i];
>               buf.append(message.getDisplayMessageBody());
>              /* Check your SMS format and respond here... */
>           }
>           }
>           NotificationManager nm = (NotificationManager)
> context.getSystemService(
>               Context.NOTIFICATION_SERVICE);
>
>           nm.notifyWithText(123, buf.toString(),
>               NotificationManager.LENGTH_LONG, null);
>
>       }
>      }
>
> }
>
> Thanks,
> Vaibhav
>
> On Thu, Mar 18, 2010 at 10:33 AM, SAM <[email protected]> wrote:
> > Hi,
> > I have a requirement to wake up my application upon receiving a
> > particular formatted SMS or App directed notification from server.
>
> > My application is in dead state. Whenever the device receives a event
> > may be a SMS in a particular format OR some notification(eg app
> > directed notification from server), android OS will start my
> > application.
>
> > Its possible in Windows Mobile and BREW.
>
> > Please let me know if its possible in Android and how.
>
> > Thanks
> > Sam
>
> > --
> > 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]<android-developers%[email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
>

-- 
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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to