Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Status Bar Hide Cordova

If I remove the status bar, every time I open the keyboard ( or a notification arrives) there is a bug.

   App.run(function($ionicPlatform) {
        $ionicPlatform.ready(function() {
          if(window.StatusBar) {     
            StatusBar.hide();
          }
        });
    });

enter image description here Image1

Any suggestion? Thank you!

like image 909
user40101121 Avatar asked Apr 15 '16 07:04

user40101121


1 Answers

Updated:

Actually, there is a fix for cordova-plugin-statusbar that has been committed on github and should land in version 2.1.4+ (i.e. you don't need an additional plugin like my original answer stated). To get the latest cordova-plugin-statusbar now, type

cordova plugin add https://github.com/apache/cordova-plugin-statusbar.git

The statusbar should now stay hidden when interacting with inputs, keyboard etc.

Original Answer:

I fixed it with the plugin cordova-plugin-fullscreen

cordova plugin add cordova-plugin-fullscreen

Then, after deviceready:

StatusBar.hide();
if (typeof AndroidFullScreen !== 'undefined') {   // Fullscreen plugin exists ?
  function errorFunction(error) { console.error(error); }
  AndroidFullScreen.isSupported(AndroidFullScreen.immersiveMode, errorFunction);
}

ImmersiveMode keeps it hidden while interacting with inputs, keyboard etc.

Note: as per the cordova-plugin-fullscreen docs, this method is only supported on Android 4.4+. There is also a 'lean mode' for Android 4.0+, but this shows the status bar while interacting (not ideal)

like image 200
Dale Avatar answered Sep 21 '22 00:09

Dale