Status bar background color overridden by the splash screen animation on Android 13
See original GitHub issueBug Report
Problem
On Android 13 the status bar background color is always black. I’ve set the color on the config.xml with the StatusBarBackgroundColor preference and it works on ios and android < 13 but not on Android 13.
What is expected to happen?
Status bar should have the color set in the config.xml.
What does actually happen?
Status bar color is black. It shows the correct color for a few milliseconds than it becomes black.
Information
Just set the background color with StatusBarBackgroundColor in the config.xml and run the application on Android 13.
Command or Code
<preference name="StatusBarBackgroundColor" value="#cccccc" /> in config.xml
This issue is solved removing the splash screen animation from the splash screen plugin:
so the splash screen plugin should fix this part of the code.
Environment, Platform, Device
Android 13, Android studio 2021.2.1 patch 2
Version information
cordova cli v 11.0.0 cordova-android v 11.0.0 cordova-plugin-statusbar v3.0.0
Checklist
- I searched for existing GitHub issues
- I updated all Cordova tooling to most recent version
- I included all the necessary information above
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:9 (6 by maintainers)
The key here seems to be the
postSplashScreenTheme
as very loosely documented by Android: https://developer.android.com/reference/kotlin/androidx/core/splashscreen/SplashScreen. This feature is supported by the splashscreen behaviour incordova-android
core: https://github.com/apache/cordova-android/pull/1441With Android 12+, this theme doesn’t apply until the splash screen is fully hidden, and when it does apply it will clobber any settings configured by the Statusbar plugin while the splash was displayed.
In my case, I’ve added a
styles.xml
file with the configuration my app was setting Statusbar to, and this resolved the issue.Added to the
config.xml
like this:Moving this to the cordova-android repo as that is what contains the splashscreen code.