Can't change Statusbar color


#1

Hello there!

I have tried several methods.

Here is what I have right now (which should work):

constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
    platform.ready().then(() => {
      statusBar.styleDefault();
      statusBar.overlaysWebView(true);
      statusBar.backgroundColorByHexString('#FF3B3F')
      //splashScreen.hide();
    })
  }

But the StatusBar is still light blue (Testing on native Device Samsung S7 via ionic cordova run android --device).

I have also tried the old way of adding this:

<preference name="StatusBarBackgroundColor" value="#FF3B3F" />

to the config.xml, but ofcourse it didnt change a thing.

Ionic info output:

cli packages:

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.0.0

#2

You just unistall statusbar and install status bar 3.12.1

npm uninstall --save @ionic-native/status-bar

to
npm uninstall --save @ionic-native/status-bar@3.12.1


#3

Small typo there.

But it still doesn’t change anything - statusbar is still blue


#4

You should not use this line if you want to change color.


#5

Commented it out, but still didnt change anything.

Also I think that the styleDefault() function is only to set the text color, because the docs say

Use the default statusbar (dark text, for light backgrounds).

which for me sounds like it only sets the text color according to the statusbar color.


#6

I tested on my android device v7.0.1 and it is working fine. In which device are you testing?


#7

Samsung Galaxy S7 running on Android 7.0


#8

Can you share code or file where you write this code?