Copy link to clipboard
Copied
I found a few posts - most quite old - this one appeared to have resolved the issue for some:
https://forum.starling-framework.org/topic/air-18-black-screen-after-standby-on-android#post-82165
Nothing worked for me - I did figure out a workaround though:
Add a listener in your main Context:
NativeApplication.nativeApplication.addEventListener(flash.events.Event.ACTIVATE , activateHandler);
In the handler - add a dummy object like a button to the stage (you can set its alpha to 0) then simply remove it after a quarter second. The removal of the object appears to kick the display back on. Note, if you try to remove the object too quickly, the display will stay black.
Copy link to clipboard
Copied
I can imagine cases where setting the stage quality to what it already is, might not do anything. On deactivate I do:
stage.quality = "low";
and on activate:
stage.quality = "medium";
Now, if you're entirely using Stage3D you can get away with a stage quality of "low", so you could do the reverse of what I do.
Copy link to clipboard
Copied
This was the answer I found in the old posts - but it didn't work for me - only adding and removing an object fixed the issue.
Copy link to clipboard
Copied
The post you linked to did a stage.quality = stage.quality, which is different to the way I do it.
Then again, I'm doing a lot of display list things, so that might be why it works for me.
Copy link to clipboard
Copied
Gotcha.. Yes, I tried both. Follow the link in that post there's also mention of doing it the way you suggested. We actually have a custom bootstrap - in there we start and stop Starling from an activate/deactivate. I have your solution for setting the quality and then reseting it in there, just in case this was somehow device specific (we're testing on a low end phone). We actually kick the events into the framework rather than adding a listener directly in the Context. A quarter second of black still isn't optimal.. but as long as there are workarounds.
Copy link to clipboard
Copied
doing if(stage) stage.quality = stage.quality, onActivate event does fix this issue.
weird after more than 1 year still not fixed by adobe air
we encounter this issue only on Android 8 Oreo
but the workaround still works thanks !
Copy link to clipboard
Copied
i have tried all the solutions up there and no one solve me the issue, i am still getting black screen when back from sleep state at Samsung Galaxy S8, here is my ACTIVATE code:
private function AppActiveHandler(e:Event):void
{
if(game_ != null)
{
game_.AppActiveHandler();
}
if(starling_ != null)
{
starling_.start();
}
// sometimes after activating the app (in very rare cases) the render is stopped
// this is the workaround to avoid this scenario.
if (nativeStage_ != null)
{
//var quality:String = nativeStage_.quality;
nativeStage_.quality = StageQuality.BEST
var q:Quad = new Quad(starling_.stage.width, starling_.stage.height);
q.x = 0;
q.y = 0;
starling_.stage.addChild(q);
Starling.juggler.delayCall(function ():void
{
starling_.stage.removeChild(q);
}, 0.25);
}
}
please suggest how should i solve this issue?
thanks.
Copy link to clipboard
Copied
There may be some things worth trying mentioned in this discussion:
context lost « Starling Forum
Check what Daniel suggests.
If things are still bad, and especially if you can make a demo file for them to check, you could raise an issue in GitHub:
GitHub - Gamua/Starling-Framework: The Cross Platform Game Engine
Copy link to clipboard
Copied
Sorry for late reply.. I would use a setTimeOut() rather than juggler - and rather than a quad try an interactive component like a button.