[Bug]: (status-bar) Setting background color in Android 15 doesn't work
Bug Report
Plugin(s)
@capacitor/status-bar 7.0.1
Capacitor Version
Latest Dependencies:
@capacitor/cli: 7.2.0
@capacitor/core: 7.2.0
@capacitor/android: 7.2.0
@capacitor/ios: 7.2.0
Installed Dependencies:
@capacitor/cli: 7.2.0
@capacitor/android: 7.2.0
@capacitor/core: 7.2.0
@capacitor/ios: 7.2.0
Platform(s)
Android 15
Current Behavior
Setting the backgroud color of the status bar in android 15 doesn't work anymore.
https://github.com/ionic-team/capacitor-plugins/blob/927f549a995118acd8e5735835300c4c3cbf3de7/status-bar/android/src/main/java/com/capacitorjs/plugins/statusbar/StatusBar.java#L65-L72
Expected Behavior
The setting of the status bar background color works as expected on android 15
Code Reproduction
Other Technical Details
Additional Context
This can be solved using the following
public void setBackgroundColor(int color) {
Window window = activity.getWindow();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) { // Android 15+
window.getDecorView().setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
WindowInsets.StatusBarInsets statusBarInsets = insets.getInsets(WindowInsets.Type.statusBars());
view.setBackgroundColor(color);
// Adjust padding to avoid overlap
view.setPadding(0, statusBarInsets.getTop(), 0, 0);
return insets;
}
});
} else {
// For Android 14 and below
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(color);
}
// update the local color field as well
currentStatusBarColor = color;
}
On android 14 either. I have a BIG blank status bar...cool
My app is showing white text on a white background and I'm assuming because of this issue I cannot customise it back. Hopefully the PR for this gets merged soon!
It seems like commits on this repo have just been chores for most of the last year though.
Same for me, after updating my Samsung Galaxy S23 from Android 14 to Android 15 I have white blank status bar. I was trying to change it's color using Capacitor StatusBar plugin but unfortunately with no success.
I actually solved this partially by setting the theme to light in my capacitor.config.ts:
/// <reference types="@capacitor/status-bar" />
import type { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
appId: 'dev.runthings.vankit',
appName: 'VanKitApp',
webDir: 'www',
plugins: {
StatusBar: {
overlaysWebView: false,
style: 'LIGHT',
// Waiting on bug fix for issue to be merged:
// https://github.com/ionic-team/capacitor-plugins/issues/2341
// backgroundColor: '#2c3e50',
},
},
};
export default config;
Light means light background, dark text.
So it got me moving forward, but can't set it to a specific colour at the moment.
Galaxy s25 on android 15 same issue.
We'll have to wait for the bug to be fixed with an update.
Try this https://capawesome.io/plugins/android-edge-to-edge-support/
await EdgeToEdge.setBackgroundColor({ color: '#5b357f' });
Works
Same error on Galaxy S23on android 15. I tested with Galaxy S20FE on android 13 works great.
Just some extra information for this issue, as it seems quite inactive and not solved yet. The root cause is directly commented in the change docs of Android SDK 35/ Android 15: https://developer.android.com/about/versions/15/behavior-changes-15#edge-to-edge
Just some extra information for this issue, as it seems quite inactive and not solved yet. The root cause is directly commented in the change docs of Android SDK 35/ Android 15: https://developer.android.com/about/versions/15/behavior-changes-15#edge-to-edge
So, we just need a capacitor update, right?
As Google Play forces all Android apps to support Android 15 API (targetSDKVersion 35) since 31st August 2025, I think we need Capacitor team to prioritize this fix.
I'm having issues with this too, on Android 15, any update?? It's been a while
we can no longer count on ionic ...
Try this https://capawesome.io/plugins/android-edge-to-edge-support/
await EdgeToEdge.setBackgroundColor({ color: '#5b357f' });Works
This worked for me. BTW you don't need to call the function. You can set the bg color by capacitor.config
This worked for me. BTW you don't need to call the function. You can set the bg color by capacitor.config
Worked for me too. In capacitor.config.ts:
EdgeToEdge: {
backgroundColor: '#161618',
}