How do I hide the navigation bar in Android Lollipop?

Get help using Construct 2

Post » Mon Feb 23, 2015 3:36 pm

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.
B
6
Posts: 24
Reputation: 302

Post » Tue Feb 24, 2015 1:20 am

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.
Image
B
74
S
23
G
3
Posts: 672
Reputation: 9,199

Post » Tue Feb 24, 2015 10:44 am

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
B
6
Posts: 24
Reputation: 302


Return to How do I....?

Who is online

Users browsing this forum: Aphelleon, LaroTaio and 2 guests