ssb.serman
ssb.serman

Reputation: 155

How to start activity from intentservice?

I have Service implements IntentService and in the OnHandleIntent I want to start activity.

It does not work:

Intent dialogIntent = new Intent(this, typeof(Activity1));
dialogIntent.AddFlags(ActivityFlags.NewTask);
this.StartActivity(dialogIntent);

what else can I try?

upd: AddFlags(ActivityFlags.NewTask); it doesnt help

Upvotes: 5

Views: 7167

Answers (1)

Long Rainbow
Long Rainbow

Reputation: 328

Intent dialogIntent = new Intent(getBaseContext(), MainActivity.class);
dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplication().startActivity(dialogIntent);

Upvotes: 9

Related Questions