i was just wondering if there was a simple way to see if an application running on android is currently in full screen. is there a way to query android to see if you're currently in full screen mode or something like that?
10 Answers
Just to complete on Sigwann answer:
boolean fullScreen = (getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0;
boolean forceNotFullScreen = (getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN) != 0;
boolean actionbarVisible = getActionBar().isShowing();

- 1,236
- 14
- 20
-
4Worth being careful on the last line there with the getActionBar().isShowing() - if you've disabled the action bar in the theme rather than just hiding it, then getActionBar() can return null. – themightyjon Jul 21 '14 at 03:34
-
I am not sure why emulator pixel 4 API 29 in Android Studio, boolean fullScreen = (getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0; return false when I used an activity with FullScreen = true style. Anyone meet the same problem? – Raii May 04 '22 at 15:53
I guess Commonsware wanted to say getWindow().getAttributes() and not getWindow().getFlags(); since getFlags does not exist as far as I know. At least it is not in doc.
you need to read getWindow().getAttributes().flags, which is an int.
WindowManager.LayoutParams lp = getWindow().getAttributes(); int i = lp.flags;
FLAG_FULLSCREEN = 1024 according to android documentation. so your flag is the 11th bite of lp.flags
if this bite = 1, full screen is activated.

- 121
- 1
- 4
Following the info of Sigwann, here my code....
public boolean isFullScreen() {
int flg = getWindow().getAttributes().flags;
boolean flag = false;
if ((flg & WindowManager.LayoutParams.FLAG_FULLSCREEN) == WindowManager.LayoutParams.FLAG_FULLSCREEN) {
flag = true;
}
return flag;
}
Simple, but works!

- 2,900
- 1
- 22
- 25
-
Still it's magic number. Better to use: WindowManager.LayoutParams.FLAG_FULLSCREEN – Dawid Hyży May 17 '16 at 11:50
You can figure out if your Activity
is running fullscreen via getWindow().getFlags()
.
However, if by "an application" you are referring to somebody else's application, then the answer is no.

- 986,068
- 189
- 2,389
- 2,491
There is a nice hack, using the absolute position of a View
on screen. Just check the position of any top left view of your layout (can be invisible), if it's on position 0,0. Like this:
/**
* Check if fullscreen is activated by a position of a top left View
* @param topLeftView View which position will be compared with 0,0
* @return
*/
public static boolean isFullscreen(View topLeftView) {
int location[] = new int[2];
topLeftView.getLocationOnScreen(location);
return location[0] == 0 && location[1] == 0;
}

- 11,855
- 3
- 51
- 62
As of api11 there is now a way to detect that using a View.setOnSystemUiVisibilityChangeListener
The listener interface documentation notes the following:
Interface definition for a callback to be invoked when the status bar changes visibility. This reports global changes to the system UI state, not what the application is requesting.
I don't know if there's a way to do it prior to Honeycomb.

- 2,126
- 16
- 23
-
This doesn't work if the application is made fullscreen in onCreate. – SnakeException Jul 28 '19 at 02:59
you may use some thing like this;
findViewById(android.R.id.content).getHeight();
getResources().getDisplayMetrics().heightPixels;
and check for equality; hope this helps;

- 31
- 5
is there a way to query android to see if you're currently in full screen mode or something like that?
You can get if your app is running in full screen;:
boolean isFullScreen = (getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0;
i was just wondering if there was a simple way to see if an application running on android
if you are tryin to get if an application is running in full screen that´s not possible programatically only visually.

- 124,308
- 23
- 334
- 268
if you want to Respond to UI visibility changes for all apps including yours, use this code
View decorView = getWindow().getDecorView();//you can also use findViewById to get the view
decorView.setOnSystemUiVisibilityChangeListener
(new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
// Note that system bars will only be "visible" if none of the
// LOW_PROFILE, HIDE_NAVIGATION, or FULLSCREEN flags are set.
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
// TODO: The system bars are visible. Make any desired
// adjustments to your UI, such as showing the action bar or
// other navigational controls.
} else {
// TODO: The system bars are NOT visible. Make any desired
// adjustments to your UI, such as hiding the action bar or
// other navigational controls.
}
}
});

- 173
- 1
- 9
Activity.hasWindowFocus() tells you if your own activity is visible to the user. But, as CommonsWare notes, it's much harder to tell if another activity is on the top of the stack. You can try querying the ActivityManager
(e.g, ActivityManager.getProcessTasks() ), but its methods don't provide an exact answer for your question.

- 11,472
- 2
- 35
- 44