Goran
Goran

Reputation: 1239

Intent from Broadcast receiver to an activity?

I have an app, that send SMS when button is clicked. After thet I am expecting a answer SMS, so it goes like this:

  1. Button click -> SMS is send (done)
  2. SMS reciver is listening for incoming SMS (done)
  3. After SMS is recived, Reciver is extracting Text from SMS and saves it to the text file on sdcard (done)
  4. After text is copied, i need to start new activity (not done)

So can i start new activity from BroadcastReceiver after recived SMS is proccessed?

Upvotes: 1

Views: 314

Answers (2)

Vineet Shukla
Vineet Shukla

Reputation: 24021

from receiver you can start the activity like this:

Intent launch = new Intent(context, ActivityToLaunch.class);
launch.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(launch);

Upvotes: 2

Ron
Ron

Reputation: 24233

Answer is Yes. You can start an activity in your BroadcastReceiver.

Upvotes: 1

Related Questions