Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show status bar in Android in PhoneGap app (ie prevent fullscreen)

I have a phonegap 3.0.0 application. My application covers the status bar (the thing with the clock, reception info, etc). Since i'm not a full screen game, this is not desirable.

I believe it's running as a "Full Screen" app.

I've found posts here on stack to do the opposite (ie make an app go full screen) and did the inverse of what was suggested. I'm wondering if something changed in PhoneGap or perhaps the PhoneGap CLI that I used to create the project because my app is showing fullscreen.

I tried this:

  public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        super.setIntegerProperty("splashscreen", R.drawable.splash);

        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

        super.loadUrl(Config.getStartUrl(), 10000);
    }

Which explicitly tells it to NOT be in full screen mode.... but it still shows up full screen.

like image 847
blak3r Avatar asked Aug 14 '13 17:08

blak3r


2 Answers

The native code suggested above will work, but a cleaner way would be just to make sure you don't have in the config.xml:

<preference name="fullscreen" value="true" />

you can also set it to "false", but its actually the default value so its not necessary. works for me.

like image 162
Liran Brimer Avatar answered Oct 22 '22 01:10

Liran Brimer


I figured it out.

The Splashscreen plugin must be setting it to fullscreen. By calling the clearFlags method AFTER super.loadUrl, once the app loads the status bar shows up.

@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    super.setIntegerProperty("splashscreen", R.drawable.splash);
    super.loadUrl(Config.getStartUrl(), 10000);

    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
like image 43
blak3r Avatar answered Oct 22 '22 02:10

blak3r