0

My application is receiving an SMS and I want to invoke an activity on receiving that SMS. How do I do this?

skink
  • 5,133
  • 6
  • 37
  • 58
Masooma
  • 1
  • 1
  • 2
  • wrongly tagged. how come it `javascript` ?? ,retagging – jmj Apr 06 '11 at 08:08
  • Duplicate of http://stackoverflow.com/questions/4998175/how-to-perform-an-action-in-android-when-receive-sms – krookedking Apr 06 '11 at 08:09
  • @krookedking - related but somewhat different. Here we want to invoke an activity (which ..., sure, yes, ... can be the "payload" of an action - but at least he needs some sort of service in the background in addition to the application/activity) – Andreas Dolk Apr 06 '11 at 08:20

1 Answers1

0

create receiver like this

     <receiver android:name=".BroadcastServiceReceiver">
        <intent-filter>
            <action android:name="android.intent.action.DATA_SMS_RECEIVED" />
        </intent-filter>
     </receiver>

in class do whatever you want

public class BroadcastServiceReceiver extends BroadcastReceiver {

      public void onReceive(Context context, Intent intent) {   
        // do you want   
      }    
}
Andreas Dolk
  • 113,398
  • 19
  • 180
  • 268
Ajay Singh
  • 1,611
  • 3
  • 22
  • 29