Black flash on transition to foreground

Has anyone else experienced their app, when transitioning from background to foreground, the screen goes black briefly before displaying the app? In fact, it actually very briefly displays the app screen, then fades to black rapidly, then fades in to the app screen rapidly?
Any ideas how to eliminate this annoyance?
Thank you.

Are you using composer (or some other scene management library) to manage your scene transitions? If you are, then your issue might be with how you are transitioning between scenes.

You could also share a small sample project that demonstrates the issue.

I do not use composer or any other scene managment library and checked into my transitions between screens. This effect happens regardless of the screen the app is on when it goes into the background. Most transitions are zoom ins. I was using a fade in on the first screen but removed that and I’m still getting the same effect.
Is there any way on S2D to control the effects when the app becomes active similar to ScenDelegate’s sceneDidBecomeActive and sceneWillEnterForeground?
I will have to experiment to produce a code snipet that reproduces the problem.

UPDATE: Right now the only thing I can think of that might make the difference is that all my screens are displayed in coroutines. That being said I have no idea why that might make a difference. This looks like something that iOS is controlling.
I also noticed this does not happen with an old iPad running iOS 9.3.5. It only happens on my devices running the latest versions of iOS.

Thank you.

Hadn’t thought of it as a problem but now that you say it I’ve tested on my game and I actually do see a fade effect similar to the one you describe. I will not try to do anything about it right now as I consider it a very minor issue, but just wanted to let you know that you’re not alone. :slight_smile:

1 Like

Thank you for your comment, Markus. After many hours of experimenting and researching I can confirm that this is a Solar 2D “Bug”. I downloaded a number of Corona based apps from the app store (Bubble Ball, Designer City) and they both produce the same effect. Personally, I find this very annoying and it makes the app look less professional.

To the Solar 2D community - please see for yourself. These are the steps to reproduce on iOS:

  1. Start up your app
  2. Hit the Home button
  3. Tap the app icon and observe. If you run your app in the Xcode simulator with Debug / Slow Animations set you can really see exactly what is going on except instead of black the coloration is pink.

Please note: sometimes the effect does not happen. In that case just open one or two more apps, hit the Home button, and repeat #3. It happens far more than it doesn’t.

Also - can anyone confirm what happens on Android devices?

Thank you all.

I have not seen this issue in Android. It behaves just like any other app that’s not from Solar2D.

1 Like

I’m wondering if this might have something to do with the very old approach to supporting iPhone 5 displays way back when.

If I’m not mistaken, back then you needed to include “Default-568h@2x.png” launch screen image in your app’s root directory to support the taller iPhone 5 display. At some point, Corona started packing that image by default and this image was just a black fill.

If Solar2D is still using that “hack approach” to working with iPhone 5 and/or newer iPhones, then the black flash that you are seeing might be that “Default-568h@2x.png” launch screen image being loaded and discarded instantly.

I guess you might be able to test that by creating a bunch of images and placing them in your app’s root directory. Look at the launch screen image sizes in If you were to just create pink launch screens and add them to your project, then I’d expect that said files would get loaded. If you see a pink flash, then your culprit would be Solar2D’s automagically loaded launch images. If you don’t see any change, then this wasn’t the issue.

1 Like

Here’s an animation of what is happening in the Xcode simulator. For some reason the mask(?) causing the flash is pink instead of black as on a real device. Nonetheless it shows clearly what is actually happening to an app when it is brought from the background the foreground. Please note the app was already launched and placed in the background. This effect does not happen on the initial launch.

You created that pink image yourself, right? If so, then that explains the “what” part of this issue.

So, as I suspected, Solar2D is showing that/those launch screen images. If you haven’t specified one, it’ll be a black rect, or if you’ve specified it, then it’ll be whatever image you’ve chosen (which is a pink rect in this case).

For now, you could try two solutions:

  1. You could try creating a transparent launch screen image and see if that works. I’m not sure how that’d play out, or if it is even possible. If there needs to be at least some non-transparent pixels in the image, you could add a black pixel to some corner.

  2. Create a visually appealing splash screen that will show for that instant. It’ll look better than those single colour flashes.

@vlads, is this something that could be be addressed at some point? i.e. should I create an issue for this in GitHub?

@XeduR - Thank you for your thoughtful attention and replies.

To answer your question - No. As I said previously - that pink image is not mine. The simulator shows it as pink and on real device it shows as black. My app does not have either. Please note that this is occurring with other apps made with Solar 2D (see Markus’ post above and other apps downloaded from the app store). I only posted the animation (which I can only create in the simulator) so it would demonstrate what is actually happening.
I have a launch screen which works perfectly. It has no pink or black in it. iOS only displays the launch screen when the app is first launched. It does not display it again when the app is subsequently brought to the foreground. Also, iOS controls the backgrounding and foregrounding of apps. When you background it takes a snapshot of the screen and uses that in its transitions. So, unfortunately these suggestions will not solve the problem. Believe me, I tried a lot of things like this already before posting on this issue. I also searched widely and could not find that this was an issue with iOS in general.

One question - can someone please indicate where is the best place to submit bugs? Here or in Github?

Thanks again.

Have you managed to solve this?

@bgmadclown Unfortunately this is not something I can solve. It is part of how Solar2D works and that code needs to be modified to get rid of this.

After I saw this, I looked at Empire City by @SGS and Flick Solitaire by @Ian_Masters. Didn’t see that behavior on those games so I thought, maybe there is something we’re missing out on your case.

Interesting. Yet I saw it on other apps I downloaded.

I can confirm that this also happens with my apps updated in the last week (4 year old iPad mini) running the latest iOS and Corona build 3604. My older apps that haven’t been updated since 2017 do not suffer from this problem.

As much as I don’t like it, I dare not hold off on updating my apps waiting for a fix.

I have been talking about this problem since last year.
Is there anybody who can clarify this issue?
This is one of the things discussed in the past.

I think it’s now in Vlad’s hands or anyone else who cares to take up modifying the code. That is beyond me at this time.
I added the issue in Github but there are many issues posted there.
Does anyone know how the backlog is managed and prioritized? @vlads

@bgmadclown you can check it out in Designer City 2 by @SGS.
And on the contrary, I wondered why no one had commented on this matter.
I’ve been talking about this since last year, but if you look at @Edissey’s video, can’t you clearly see the problem?

In the video, The left is a game made by @SGS with Corona, and the right is a game made with Unity.

@bgmadclown @SUPER_TOKI
Not seeing anything in the video. All I see is a blank screen.
AND just like that it has appeared :slight_smile:

I forgot to correct myself earlier, sorry about that. After looking at it a few more times I realized this was a thing. Most developers probably think it’s not that big of a deal. I haven’t realized the transition until I saw this thread :slight_smile: