0 Favourites

How do I hide the navigation bar in Android Lollipop?

  • 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.

  • 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.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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)
Similar Topics Posts Views Last Post
Unread sticky
763 305,702
asikanddestroy's avatar
asikanddestroy
Unread hot topic
0 Favourites
New Android Export Experiences
494 67,275
jabk's avatar
jabk
Unread hot topic
99 10,152
karshinkoff's avatar
karshinkoff