Resuming an app with an intent having FLAG_ACTIVITY_MULTIPLE_TASK set causes it to hang in Titanium 8.0.0 if the app does not immediately open a window via its "newintent" event.
Titanium 7.x.x and older isn't much better. It won't hang on startup, but will instead create a new splash screen activity instance and do nothing.
The Android OS will automatically add the FLAG_ACTIVITY_MULTIPLE_TASK to intents assigned the ACTION_SEND action. So, apps whose intent-filter do not handle "intent-filter" ACTION_SEND typically don't have to worry about this issue.
Steps to reproduce:
- Create a classic Titanium app.
- Set project name to "IntentTest". (This is <name/> in "tiapp.xml".)
- Set project's "Application Id" to "com.appc.intent.test". (This is <id/> in "tiapp.xml".)
- Set up the "app.js" with the below code.
- Build and run on Android.
- Open the Mac "Terminal".
- CD (change directory) to: ~/Library/Android/sdk/platform-tools
- In the terminal, enter the following...
In Titanium 8.0.0 and higher, the app hangs. Also notice in the log that the "newintent" is being logged non-stop, meaning the "newintent" event is being fired repeatedly when it should only be fired once.
In Titanium versions older than 8.0.0, a new splash screen activity window is displayed, but nothing happens. Note that the app is not hung and you can back-out of the splash window, but this is still not good behavior.
The "newintent" event should only be fired once and not hang the app.
Immediately open a window when a "newintent" is received set with this flag.
If you don't want to open a window immediately, then you can instead quickly open/close a temporary window when this flag is set. Note that closing a window immediately as shown below prevents it from ever being shown, because Titanium destroys it via the activity's onCreate() method.
(I've tested the below on Android Q while target API Level 29. It works fine.)