This is a little involved, so bear with me.
I've got two Android apps - one built in Adobe Air (the 'launcher') and one downloaded from the google play store (the 'target.') At a certain point I want the 'launcher' to open the 'target' and switch to it. Currently I'm doing this via the 'intent' protocol, like so:
navigateToURL(new URLRequest('intent:#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;component=com.magix.camera_mx/com.magix.android.cameramx.main.MainMenu;end'));
... and it works, but when the 'target' (CameraMX in this example) opens, it uses the same 'window' as the 'launcher' app. Here's two screenshots, before and after opening the 'target:'
That's inconvenient, but I could put up with it if it was consistent. However, when I try the exact same process, only launching an arbitrary other app like Kingsoft Office:
navigateToURL(new URLRequest('intent:#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;component=cn.wps.moffice_eng/cn.wps.moffice.documentmanager.PreStartActivity;end'));
The 'target' and 'launcher' exist as nice separate windows.
Why is that? What dictates whether an app comes up as a separate window, or reuses the current one? I've tried it with a handful - notably SoulCraft and Starchart launch in a new windows, but mostly the others all reuse the current window.
Is that something I have control over from within my air app? What's going on here?
The difference between your two scenarios (scenario 1 remains in a single task, scenario 2 starts a new task) is due to each "target" app's intent-filter manifest definition.
If you do not require a result from the Intent you can add flags (http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NEW_TASK) like below:
What you're calling a "window" is referred to in Android as a "task". You should be able to force the target application to open in a new task by setting appropriate flags, namely
FLAG_ACTIVITY_NEW_TASK
(note thelaunchFlags=0x10000000
):