Android Immersive Mode target-sdk-version="23"

I’m using fbricker’s extension-admob and it requires sdk v23, so I have this in my project.xml:

<android target-sdk-version="23" if="android" />

The top bar (with time/battery/etc) is always visible and I can’t make it go away. I’ve setup a templates folder where I can override templates but don’t know what to do to hide it.

In GameActivity.java there’s this: (I haven’t changed aanything, yet)

	@Override
	public void onWindowFocusChanged(boolean hasFocus) {
		super.onWindowFocusChanged(hasFocus);
		
		if(hasFocus) {
			hideSystemUi();
		}
	}

	private void hideSystemUi() {
		
		if (Build.VERSION.SDK_INT >= 19) {
			
			View decorView = this.getWindow().getDecorView();
			
			decorView.setSystemUiVisibility(
				View.SYSTEM_UI_FLAG_LAYOUT_STABLE
				| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
				| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
				| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
				| View.SYSTEM_UI_FLAG_FULLSCREEN
				| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
			
		}
		
	}

It looks like it should hide it and give me fullscreen since I’m targeting sdk build v23.

Do you test it on device with android version < 4.1 ?
Because you should use different code to hide status bar on android 4.0 and lower: https://developer.android.com/training/system-ui/status.html

Hi! we have done an extension that handles immersive mode

try using that and tell me if you have any troubles :smiley:

Thanks guys.

@restorer Yes. I was testing on 4.0. I’m looking at the link to see how I can fix this. I’m not sure what I’m doing with modifying behind the scenes templates but I need to learn.

@Joacko I’ll have a look at your extension, I’m sure it will be an easier solution for me.