Skip to main content
Inspiring
September 1, 2017
Question

Black screen on Android when returning from sleep

  • September 1, 2017
  • 2 replies
  • 3820 views

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.

This topic has been closed for replies.

2 replies

Known Participant
March 22, 2018

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 !

mohammado59081064
Participant
August 27, 2018

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.

Colin Holgate
Inspiring
August 28, 2018

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 

Colin Holgate
Inspiring
September 1, 2017

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.

dewsAuthor
Inspiring
September 1, 2017

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.

Colin Holgate
Inspiring
September 1, 2017

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.