Problem with status bar color

Can this be done within the Ionic View app?

I’ve installed the plugin from the repo, linked to the script in the HTML, added the library to my module, and included the function as its listed above.

I haven’t learned how to create real Android emulations, so I’m working within the Ionic View app, but the Status Bar isn’t updating. Is it simply because I’m inside the app?

This is not possible inside of view.

Did anything come of this. What was the final solution. I am having the same problem with ios.

I’ve tried with StatusBar directly from native cordova, and later I’ve tried with $cordovaStatusbar plugin.
Both cases I tested on my device (LG G3 - Android 5.0) and it’s NOT WORK =(.
I tested on simulator (Genymotion) in versions above 5.0, and it’s work.
Is this normal? In some devices, can it not work in specific devices?

I have same error with cordova 5+ and android 5.1.1 on LG Magna, here is my code

if (StatusBar) {
// org.apache.cordova.statusbar required
if (cordova.platformId == ‘android’) {
StatusBar.overlaysWebView(false);
StatusBar.backgroundColorByHexString("#fff");
}
//StatusBar.styleDefault();
}

i’he tried to run this commands in google chrome://inspect/#devices but has no effect, and always i receive an “undefined” after execute this commands, a little help please?

hi
i tried to change status bar color also use same way but not work.
but now i change in
project dir->plugins>cordova-plugin-splashscreen->src->android->SplashScreen.java

change inside this
setStatusBarBackgroundColor(preferences.getString(“StatusBarBackgroundColor”, “#000000”));

to

setStatusBarBackgroundColor(preferences.getString(“StatusBarBackgroundColor”, “#04ADC0”));//your color hexstring here

then remove android platform
and
add android platform again

its works!..

1 Like

I doubt this would be the preferred solution. You’re overriding the default in the plugin, and setting it explicitly to your chosen color. I’ll advise upgrading to the latest version of the plugin

Hi @mhartington

I want to change the status bar color in Android 4 version.
By default it shows black color.

Any solution for this?

Thanks in advance

nope really didn’t work at all

plugin –
org.apache.cordova.statusbar= https://github.com/apache/cordova-plugin-statusbar.git

and inside config method add
if (window.StatusBar) {

                if (ionic.Platform.isAndroid()) {
                    StatusBar.backgroundColorByHexString("#3f723b");
                } else {
                    StatusBar.styleLightContent();
                }
            }

Hi ,

I am also facing same issue I am unable to set background color, can someone please help me ?
here is my code

initializeApp() {
this.platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
//StatusBar.styleDefault();
//StatusBar.overlaysWebView(true);
StatusBar.backgroundColorByName(“red”);
Splashscreen.hide();
this.getUsers();
});
}

Note : I have tried install and uninstall of StatusBar plugin but did’t work

Thanks
Samiran