0

https://github.com/apache/cordova-plugin-statusbar says to use StatusBar.hide(); to hide the statusbar, but I don't see any documentation about where it goes other than "after the deviceready event", which doesn't explain which file it should go to? index.js??

I've added the plugin and followed all the steps up to this -- adding a simple code snippet to a mystery file somewhere within the project (or program files??) :\

If anyone knows more about this I would really appreciate the help. Was looking around all day trying to get this working.

3 Answers3

1

If you wanna hide status bar at startup, then you may have to invoke the hide function inside deviceready event listener. So which file it should get into depends on where you have registered deviceready event listener.

You can also invoke it anywhere in your app where you wanna hide your statusbar provide the plugin is completely loaded. But generally the most used scenario is to hide the statusbar on app startup. More info on achieving this available in the offical docs and SO post

Community
  • 1
  • 1
Gandhi
  • 11,875
  • 4
  • 39
  • 63
0

If you want to hide status bar ASAP use deviceready event on index.html:

document.addEventListener("deviceready", function () { StatusBar.hide(); }, false);

Also you can use a separate js file for it.

daniil_
  • 707
  • 7
  • 26
0

Unfortunately, none of these solutions worked for me (although they should be correct and are mentioned all over the internet). This is what did it for me, placing this at the bottom of my www/index.html file:

<script> 
$(window).bind("load", function() {
StatusBar.hide();
});
</script>