[TIMOB-25867] Android: Running an application through CLI flickers it's main activity at launch.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-06-07T02:39:35.000+0000 |
Affected Version/s | Release 6.3.0, Release 7.1.0, Release 7.0.2 |
Fix Version/s | Release 7.3.0 |
Components | Android |
Labels | n/a |
Reporter | Yordan Banev |
Assignee | Yordan Banev |
Created | 2018-03-14T17:06:12.000+0000 |
Updated | 2018-06-28T22:18:23.000+0000 |
Description
Starting an Android application with 'appc run' or 'ti build' causes it to flicker at start when the main activity is launched.
Launching afterwards from the device works just fine.
PR: https://github.com/appcelerator/node-titanium-sdk/pull/26
titanium-mobile PR: https://github.com/appcelerator/titanium_mobile/pull/9938
[~ybanev], removing the "-n" parameter triggers our "Restart Required" dialog on app startup and it gets stuck in an infinite loop displaying this dialog. This happens to me on a real Pixel XL device. Note that not all devices exhibit this behavior, but it shows that the default intent handling is not the same across all devices and we should be explicit. I think a better solution would be to keep the "-n" parameter (it is needed to specify the package/activity name)... and also provide intent parameters action "MAIN" and category "LAUNCHER" so that we'll correctly simulate an app launch from the app menu. For example:
I'll write up a PR since what I'm doing solves another problem as well. _Edit: Added "-f 0x10200000" intent flags parameter which sets
FLAG_ACTIVITY_NEW_TASK
andFLAG_ACTIVITY_RESET_TASK_IF_NEEDED
. I've verified that these flags are set when launch from the app menu on the newest Android OS versions. Android 4.1 only sets theFLAG_ACTIVITY_NEW_TASK
flag, but adding the 2nd flag is harmless for that version._[~jquick] I checked it and it seemed that the
-n
flag had no effect. Both running the command's help and the docs do not indicate that the-n
flag does anything: https://developer.android.com/studio/command-line/adb#am.[~cbarber], Just updated my comment. It happens to me on a real Pixel XL device. Not all devices have this behavior though. I'm going to go ahead with my changes since those extra arguments is how Android Studio does it.
Also, the
-n
flag is used to specify the component name for the intent as documented here... https://developer.android.com/studio/command-line/adb#IntentSpec I agree that the way Google documents it in the link below doesn't make it clear, but instart [options] intent
, theintent
part takes the intent arguments in the link above. https://developer.android.com/studio/command-line/adb#am Case-in-point, I can do the following to show our website via the default web browser app...Developers sometimes do stuff like the above to easily test their app's intent-filter handling, such as with customer URL schemes.
Verified the fix in SDK 7.3.0.v20180628132121. Closing.