Forums

OverviewV-Play 2 Support (Qt 5) › Android Fullscreen support

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #8987

    Caeser

    How can i make my game 100% fullscreen on android? This is where the status bar and the navigation bar are hidden, i think its called immersive layout.

    #8988

    Alex
    V-Play Team

    Hi,

    Good question, that’s an advanced topic: In order to use immersive mode you have to subclass the default Android activity and add some flags:

    Let us know if that worked for you!

    Best,
    Alex

    #8989

    Caeser

    Hi,  this is interesting but does this support vplay games, how will i use the new activity in my game?

     

    #8990

    Alex
    V-Play Team

    Absolutely, I already tried a demo with it, it’s running fine when you’re following the steps below. 😉 If you need further help just let us know.

    We probably add this directly into V-Play with one of the following updates.

    Cheers,

    Alex

    #8991

    Caeser

    Cool. Alex would u please share with me demo so I can easily follow up.

    #8994

    Heini

    1 upvote for integrating it into V-Play!

    #8997

    Caeser

    Hi i managed to apply android  immersive layout to my game but there is black space at the top and bottom, it seems the Gamewindow is not going fullscreen of the phone. Alex can you help me on this part.

     

     

    #8998

    Caeser

    no wait but the game over screen is fully full screen so it must be an issue with my layout settings. i will look into this myself, thanks.

     

    here is a snippet to use to add immersive layout in your app or game.

     

    1. look for QtActivity.java

    for example under C:\Qt\Qt5.2.0_android\5.2.0-rc1\android_armv7\src\android\java\src\org\qtproject\qt5\android\bindings\QtActivity.java

    2. copy this line of code.

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      if (hasFocus) {
        getWindow().getDecorView().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);
      }
    }

    3. look for the onWindowFocusChanged method in the QtActivity.java

    4. Paste the above code in the method, example

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
      if (!QtApplication.invokeDelegate(hasFocus).invoked)
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
          if (hasFocus) {
          getWindow().getDecorView().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);
        }
      }
      super.onWindowFocusChanged(hasFocus);
    }

    5. Save the file and run your game on devices Kitkat and above.

    I upvote this feature for v-play.

    Thanks

    #8999

    Alex
    V-Play Team

    Thanks for sharing (I re-styled the snippet a little bit)!

    Just a short note: If you edit the mentioned QtActivity.java it will apply to all new projects. The better approach therefore might be to create an own activity class like described in my first post.

    Cheers,

    Alex

    #9001

    Caeser

    oh great, Thanks Alex

Viewing 10 posts - 1 through 10 (of 10 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support