How do I hide the navigation bar in Android Lollipop?

0 favourites
  • 3 posts
From the Asset Store
Custom animated Health Bar - check youtube video to make it yourself
  • Hey, so I asked a similar question on how to make the game full screen and yes I know you check the full screen option in Intel XDK, but that still doesnt hide the navigation bar which is totally possible in android lollipop as its done in the YouTube app. So I am wondering if anyone here has any prior experience on how to do this with either construct 2 or Intel XDK. I did some research and found this: https://github.com/mesmotronic/cordova- ... een-plugin ,but cant get it to work, maybe its because I dont know how to install the plugin or how to put the code in and where to put the code in.

    I also found this thread on the forum plugins-cordova-related-c2-plugins-crosswalk-list_t109586?&hilit=navigation+bar+hide+navigation+bar&start=310 where they talk about immersive mode, and the plugins are made by cranberrygame, but I would have to buy the whole pack in order to get immersive mode.

    Please help as I want my game to take advantage of the "true" full screen on android lollipop or also called immersive mode, and maybe you guys know a better way of doing it.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Paste the following JavaScript in the <Body> tag of the index.html file

    <!-- MY CODE START -->

    <script>

    if(navigator.userAgent.match(/Android/i)){

    window.scrollTo(0,1);

    }

    </script>

    <script>

    // When ready...

    window.addEventListener("load",function() {

    // Set a timeout...

    setTimeout(function(){

    // Hide the address bar!

    window.scrollTo(0, 1);

    }, 0);

    });

    </script>

    <script>

    function hideAddressBar(){

    if(document.documentElement.scrollHeight<window.outerHeight/window.devicePixelRatio)

    document.documentElement.style.height=(window.outerHeight/window.devicePixelRatio)+'px';

    setTimeout(window.scrollTo(1,1),0);

    }

    window.addEventListener("load",function(){hideAddressBar();});

    window.addEventListener("orientationchange",function(){hideAddressBar();});

    </script>

    <!-- MY CODE END -->

    It covers several triggers that should remove the address bar.

  • Hey, thanks for the reply, but it still doesnt work :c Here is a screenshot http://i.imgur.com/7dw8ov4.jpg (I cant upload it here so I uploaded it to imgur), and maybe I am doing something wrong. When I try the apk on my nexus 5 the navigation bar still shows the back/home/multitasking bar is still there and doesnt dissapear.

    Thank you

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)