Need help with status bar color


#1

Hello, I saw some posts on changing the status bar color in android 5, and I tried all the demos and advice ,but nothing worked…did anyone actually succeed in making it work? @mhartington, I saw you wrote some tips, is there any update perhaps on a working example? I really want to fix this…

Thanks :slight_smile:


#2

Sure, so first, I installed the status bar plugin

ionic plugin add cordvoa-plugin-statusbar

Then I setup some logic in my run phase

.run(function($ionicPlatform, $timeout) {
  // This is an ionic wrapper for cordova's
  // device ready event.
  $ionicPlatform.ready(function() {
    // if we have the keyboard plugin, let use it
    if (window.cordova && window.cordova.plugins.Keyboard) {
      //Lets hide the accessory bar fo the keyboard (ios)
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      // also, lets disable the native overflow scroll
      cordova.plugins.Keyboard.disableScroll(true);
    }
    if (window.StatusBar) {
      if (ionic.Platform.isAndroid()) {
        StatusBar.backgroundColorByHexString('#1976D2');
      } else {
        StatusBar.styleLightContent();
      }
    }
    $timeout(function() {
      navigator.splashscreen.hide();
    });
  });
})

#3

Hi @mhartington , thanks for the help. i tried this again, and the status bar stays the same… i also tried to clone your Philly repo, and build it to check things out, but still, i can’t see any change with the status bar color…

At least i now know you play the guitar man :slight_smile: that’s great! i am actually a professional piano player and i play lots of chopin , i actually plan to build an app about chopin in ionic…

but currently i just need to know how to make the status bar with a different color…
I have an LG G3 with android 5… so i am supposed to see something right?

Thanks,
Shaul,


#4

Hmm, did you include the cordova status bar plugin? Just tried this and it worked fine for me


#5

ionic plugin add cordova-plugin-statusbar