Cannot get cordova-plugin-status settings panel to set color on Android

This question is similar to this one , however I tried everything and still cannot get the cordova-plugin-statusbar to work.

I am using PhoneGap Build to create a PhoneGap / Cordova application. In config.xmlI have a plugin included like this:

<gap:plugin name="cordova-plugin-statusbar" source="npm" />

And then I have JavaScript to set the color of the status bar:

document.addEventListener('deviceready', SetStatusBarColor, false);

function SetStatusBarColor() {
  if (StatusBar) {
    StatusBar.backgroundColorByHexString('#4CAF50');
  }
}

However, no matter what I do, I can not get the status bar to change the color of the phone. PhoneGap uses Cordova version 5.2.0, and my phone has Android 5.1.1.

+2
source share
1

. :

$ cordova plugin add cordova-plugin-statusbar

config.xml:

<preference name="StatusBarOverlaysWebView" value="true" />
<preference name="StatusBarBackgroundColor" value="#BE1912" />

'# BE1912' - ( ).

java script :

if (window.cordova && StatusBar)
{
    StatusBar.backgroundColorByHexString('#BE1912');
}
+4

All Articles