liilo
liilo

Reputation: 89

Android start external intent action then reopen your app

I start a partner (external) app (with a custom intent action) like this :

Intent i = new Intent("com.myapp.action.MY_ACTION");
i.putExtra("param1", "value1");
...
startActivity(i);

The partner app is then launched and the action is performed. My problem is when re-opening my app (after pressing home button for example), the view displayed is the partner app and I have to press the device back button to go back to my app. Is there a way to stay in my app when re-opening it?

Thanks

Upvotes: 1

Views: 361

Answers (1)

David Wasser
David Wasser

Reputation: 95626

Of course. Launch the partner app into a new task. If the user returns to your application (via HOME key press or from the list of recent tasks), your app will appear, not the partner app:

Intent i = new Intent("com.myapp.action.MY_ACTION");
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.putExtra("param1", "value1");
...
startActivity(i);

Upvotes: 1

Related Questions