You do this by adding code from https://developer.android.com/training/system-ui/immersive.html in your main java activity class. This applies to cocos2d-x 2.x so not sure how to add it for 3.x yet. Your activity class would then look like this for example:
public class YourApp extends Cocos2dxActivity
{
private Cocos2dxGLSurfaceView glSurfaceView;
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
}
public Cocos2dxGLSurfaceView onCreateView()
{
glSurfaceView = new Cocos2dxGLSurfaceView(this);
this.hideSystemUI();
// create stencil buffer
glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
return glSurfaceView;
}
public void onWindowFocusChanged(boolean hasFocus)
{
super.onWindowFocusChanged(hasFocus);
if (hasFocus)
{
this.hideSystemUI();
}
}
private void hideSystemUI()
{
// Set the IMMERSIVE flag.
// Set the content to appear under the system bars so that the content
// doesn't resize when the system bars hide and show.
glSurfaceView.setSystemUiVisibility(
Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_LAYOUT_STABLE
| Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
| Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
static
{
System.loadLibrary("cocos2dcpp");
}
}