Black or blank screen seen after keeping application idle and then open the application in cordova version >= 10.
Bug Report
Problem
Device is having lock screen password.Black or blank screen seen after keeping application idle and then open the application in cordova version >= 10.Issue is not seen in older cordova version.
What is expected to happen?
There should not be any Black or blank screen seen after idle.
What does actually happen?
There is Black or blank screen seen after idle.
Information
Device is having lock screen password. Keep cordoava application idle for sometime and open.
Environment, Platform, Device
Android Devices.
Version information
Cordova v >= 10.
Checklist
- [x ] I searched for existing GitHub issues
- [x ] I updated all Cordova tooling to most recent version
- [ x] I included all the necessary information above
It's possible that the blank screen you're seeing is the splashscreen without the icon resource being rendered, which is a bug within the android platform. The splash screen will be black or dark if the device is using a night/dark theme.
Having a small video clip of what you're seeing can probably tell us if this is the issue you're experiencing.
- https://issuetracker.google.com/issues/205021357
Please check the video for reference. @breautek
Edit: Removed the video. Sample app will made to reproduce to know exact RCA.
Thanks.
Yah that's a strange one, that black screen isn't the splashscreen. If it was, it would have been black immediately before seeing your application view, and then typically the splashscreen will get dismissed showing your application view.
Here we see your application view, without seeing any splashscreen immediately, and then the screen goes black. So I don't think it's actally that splashscreen bug that I linked above.
Is this issue reproducible in a sample test application? If you can provide one, it will help isolate the cause away from your own application and/or any plugins that your project might be running which will in turn help find the root cause.
Relating to the Android platform bug in https://issuetracker.google.com/issues/205021357,
I saw that someone listed a possible fix in comment 69 for the icon not displaying when launching the app from a notification, which I'm also experiencing using cordova-android 13.0.0, on an Android 14 device. The solution seems to be to add the following item to styles.xml (which I assumed to be themes.xml in Cordova):
<item name="android:windowSplashScreenBehavior">icon_preferred</item>
I tried adding the "icon_preferred" item to android/app/src/main/res/values/themes.xml but it didn't seem to resolve it. I'm not sure whether cordova-android needs to integrate this before it takes effect.
The Android documentation also seems to list this item as an option to always display the splash screen icon. (https://developer.android.com/develop/ui/views/launch/splash-screen#set-theme)
Could this solution possibly be tested in cordova-android to confirm whether it resolves the issue?
Relating to the Android platform bug in https://issuetracker.google.com/issues/205021357,
I saw that someone listed a possible fix in comment 69 for the icon not displaying when launching the app from a notification, which I'm also experiencing using cordova-android 13.0.0, on an Android 14 device. The solution seems to be to add the following item to styles.xml (which I assumed to be themes.xml in Cordova):
<item name="android:windowSplashScreenBehavior">icon_preferred</item>I tried adding the "icon_preferred" item to android/app/src/main/res/values/themes.xml but it didn't seem to resolve it. I'm not sure whether cordova-android needs to integrate this before it takes effect.
The Android documentation also seems to list this item as an option to always display the splash screen icon. (https://developer.android.com/develop/ui/views/launch/splash-screen#set-theme)
Could this solution possibly be tested in cordova-android to confirm whether it resolves the issue?
Looks interesting, though it seems to only apply on API 33+ devices (Android 13 and later), based on the docs:
You can use windowSplashScreenBehavior to specify whether your app always displays the icon on the splash screen in Android 13 and higher.
I tried adding the "icon_preferred" item to android/app/src/main/res/values/themes.xml but it didn't seem to resolve it. I'm not sure whether cordova-android needs to integrate this before it takes effect.
It's weird that it doesn't appear to be working on Android 14. That should be the right place for this, but if you're editing the file manually and using the Cordova CLI to build, the CLI might be replacing and overwriting that themes file. If this is happening, then building and testing directly from Android Studio might allow you to test the parameter.
confirm whether it resolves the issue?
I don't have access to the original video but based on https://github.com/apache/cordova-android/issues/1712#issuecomment-2112393643 it seems like the OP issue didn't appear to be related to https://issuetracker.google.com/issues/205021357 and was likely an application issue rather than a framework issue. So I don't think it will solve this issue (which seems stale now, as no reproduction app was ever produced), but that doesn't mean we can't expose the behaviour option through a preference or something.
most of the time it's black, sometimes white until i click on the screen everything goes back to normal