Didac Perez Parera
Didac Perez Parera

Reputation: 3834

Launch an application in a different "context"

First of all, sorry for the "context" in the question title, I didn't know which word to use. I successfully launch my app by clicking over a URL from another application, but when I launch the task manager I realize that my application is not actually loaded: the caller app holds the activities. I would like how to:

Thank you so much.

Upvotes: 0

Views: 63

Answers (2)

Joe
Joe

Reputation: 14059

In addition to launchMode that Kai mentioned, you might also want to look at taskAffinity and allowTaskReparenting, depending on how your app is structured.

This is an excerpt from there that seems to match how you describe your app:

For example, if an e-mail message contains a link to a web page, clicking the link brings up an activity that can display the page. That activity is defined by the browser application, but is launched as part of the e-mail task. If it's reparented to the browser task, it will be shown when the browser next comes to the front, and will be absent when the e-mail task again comes forward.

Upvotes: 1

Kai
Kai

Reputation: 15476

You can modify the behavior by setting "launchMode" attribute in AndroidManifest.xml to either "singleTask" or "singleInstance", both would cause your Activity to be created as the root of a new task. However it doesn't restart the Activity if it exist already, instead you should handle the Activity.onNewIntent(Intent intent) callback.

To learn more on launchMode see here: http://developer.android.com/guide/topics/manifest/activity-element.html#lmode

Upvotes: 1

Related Questions