I know there have been a lot of black screen reports from AIR over the years but I feel like I've encountered something distinctly different. I've been debugging an Android specific issue and it's lead me to some questions that I need help with as Android is not my forte...
Taking a Starling app and upgrading to AIR 24+, Android now gets a black screen on only the first resume of the application. On first resume, I get a black screen with the status bar at the top and the game clearly running in the background (debugger connects and music plays). However, I am unable to interact with the game (as was reported in other black screen threads). Now for the interesting part, if you force stop the application and relaunch, the initial load and ALL following suspend resume actions work perfectly with no black screen. It doesn't matter if it's a debug or release build, and doesn't matter how/from where you start the app.
I have run through every black screen thread and nothing has worked. I'm doing all of the onActivate/onDeactivate stage.quality tricks, containsVideo tags, etc. I have seen the suggestions for using singleTop launchMode which does appear to fix the issue. However, I need to use Android launchMode standard for activity stack maintaining (for facebook login etc).
Concluding that this might not be the typical black screen issues I started investigating Android activity states with adb shell and I've found a few interesting things. Running 'adb shall dumpsys activity' I've been comparing the activity Intent tasks for my app between AIR 23 and AIR 24+ builds and have noticed some odd differences. Previously, my application Intent would run with two flags (NEW_TASK, and RESET_TASK_IF_NEEDED) no matter what state it was in. However, in AIR 24+, on the first suspend, the activity is losing it's bnds (which I believe is screen coordinate binding???) and the intent flag is losing the RESET_TASK_IF_NEEDED value.
I've copied the relevant adb output below (sorry but a code block seemed most readable)...
AIR 23 Build The Task listing remains the same (aside from moving between stacks) through the three tested game states (just after first launch, just after first suspend, and just after first resume):
Task id #801
TaskRecord{eb77f80 #801 A=air.com.toystudio.casinotower U=0 sz=1}
Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=air.com.toystudio.casinotower/.AppEntry VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)} bnds=[1698,944][1998,1186] (has extras) }
Hist #0: ActivityRecord{649aa75 u0 air.com.toystudio.casinotower/.AppEntry t801}
Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=air.com.toystudio.casinotower/.AppEntry VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)} bnds=[1698,944][1998,1186] (has extras) }
ProcessRecord{aa9a5f3 16332:air.com.toystudio.casinotower/u0a382}
AIR 24+ Build Just after first launch: (everything looks the same as in AIR 23)
Task id #787
TaskRecord{1f215a7 #787 A=air.com.toystudio.casinotower U=0 sz=1}
Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=air.com.toystudio.casinotower/.AppEntry VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)} bnds=[1698,944][1998,1186] (has extras) }
Hist #0: ActivityRecord{6d91889 u0 air.com.toystudio.casinotower/.AppEntry t787}
Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=air.com.toystudio.casinotower/.AppEntry VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)} bnds=[1698,944][1998,1186] (has extras) }
ProcessRecord{b3c48a8 596:air.com.toystudio.casinotower/u0a375}
Just after first suspend: (note the change in 'flg' and the now missing 'bnds'. Also note that task id is different because the outputs are from different tests)
Task id #798
TaskRecord{87c1429 #798 A=air.com.toystudio.casinotower U=0 sz=1}
Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=air.com.toystudio.casinotower/.AppEntry VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)} }
Hist #0: ActivityRecord{148e44 u0 air.com.toystudio.casinotower/.AppEntry t798}
Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=air.com.toystudio.casinotower/.AppEntry VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)} }
ProcessRecord{38791ba 14679:air.com.toystudio.casinotower/u0a381}
Just after first resume (screen is black but game running): (now everything is really mangled. I somehow have two activities listed, both have incorrect flags, and only one has a window binding)
Task id #785
TaskRecord{c0a012d #785 A=air.com.toystudio.casinotower U=0 sz=2}
Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=air.com.toystudio.casinotower/.AppEntry VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)} }
Hist #1: ActivityRecord{924bd86 u0 air.com.toystudio.casinotower/.AppEntry t785}
Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10600000 cmp=air.com.toystudio.casinotower/.AppEntry VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)} bnds=[1698,944][1998,1186] (has extras) }
ProcessRecord{df8d47f 31595:air.com.toystudio.casinotower/u0a375}
Hist #0: ActivityRecord{38d61a1 u0 air.com.toystudio.casinotower/.AppEntry t785}
Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=air.com.toystudio.casinotower/.AppEntry VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)} }
ProcessRecord{df8d47f 31595:air.com.toystudio.casinotower/u0a375}
Here is my core Android activity xml:
<activity
android:excludeFromRecents="false"
android:launchMode="standard">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<data android:scheme="casinotower" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
Once you force close and start using the app again, the Task timeline matches the AIR 23 build. I'm looking for suggestions on what might be happening on that first suspend to my flg and bnds states. I run a number of ANEs but none of them did this previously. Again, Android isn't my strong suite so I'm unsure if this is correct functionality but it certainly seems distinctively incorrect and I'm unsure where to go from here. While it seems to me like something changed in AIR 24 that is breaking my app I want to make sure I'm not doing anything wrong on my end.
Happy to provide any additional information, I appreciate any thoughts!
This is what I did after searching for hours:
<activity android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
Change launchMode
to "singleTop"
.
User contributions licensed under CC BY-SA 3.0