In the new KitKat there is immersive full screen mode that can be used like this:
To provide your app with a layout that fills the entire screen, the
new SYSTEM_UI_FLAG_IMMERSIVE flag for setSystemUiVisibility() (when
combined with SYSTEM_UI_FLAG_HIDE_NAVIGATION) enables a new immersive
full-screen mode.
http://developer.android.com/about/versions/android-4.4.html#UI
I'm wondering if it is possible to set this mode for an Activity or full application in the manifest?
There is no way to declare immersive mode in the manifest or window flags.
It's only available via the view-level SYSTEM_UI_FLAG_IMMERSIVE flags, which indicates that it is a request, not a mandate - and that it is a temporary mode.
The system may choose to ignore the request or exit immersive mode at any time, your app should handle those cases.
It's also worth pointing out that hiding the primary navigation on a mobile device is not something to be taken lightly. It's not appropriate for all apps, and should not be done without thought.
Related
How to disable the SplitScreen mode in Android 7.1.1 without disabling the MultiWindow mode?
I am using Freeform Window Mode to open multiple activities. In landscape orientation of device when an activitiy is dragged to the left or right edge of the screen the activity gets docked and the StackDivider splits the screen. Disabling MultiWindow mode eventually disables Freeform Window mode. So is there any way to disable the SplitScreen mode only (without disabling MultiWindow mode) by editing the Android source code?
https://developer.android.com/guide/topics/ui/multi-window.html
As per documentation, do this in you manifest activity or application
android:resizeableActivity=["true" | "false"]
In freeform mode, when an application or window is moved left or right corner of the screen by dragging its DecorCaptionView a dim layer is generated either at left or right depending on the position of window and it get docked to the current dim side on MOtionEvent.ACTION_UP event.
The MotionEvent actions on DecorCaptionView is handled by frameworks/base/services/core/java/com/android/server/wm/TaskPositioner.java and moveTaskToDockedStack() method in ActivityManagerService is invoked whenever a window gets docked. The updateDimLayerVisibility() method in TaskPositioner.java is responsible for the creation of dim layer. So the SplitScreen mode can be disabled by commenting out above mentioned two method calling lines in TaskPositioner.java.
I have got the multi-window feature to work however, this is applied to all activities across the application. I would like to know is there a way to specify which activity that can use multi-window? For example, I have an introduction slider in which I would like to disable the feature and re-enable in the main activity. Thanks.
By launching activity in new task stack, you can accomplish this. But from user experience point of view, this may not be a good solution.
When app is in split screen mode, launch the activity, which you don't want do display in multi-window mode, by firing intent. Make sure that the target activity config in manifest is not multi-window enabled.
To go back to multi-window mode from full screen, you need to launch main activity in a new stack with below intent flags.
FLAG_ACTIVITY_LAUNCH_ADJACENT and FLAG_ACTIVITY_NEW_TASK
Im developing an android application for a school and i want this application when opened to prevent the user from doing anything on the device except what im offering inside my application, and i mean doing NOTHING else...
so first the Navigation bar should be disabled and hided
i saw this but its for 4.4+ and it doesn't solve the problem because if you swipe the screen you will get the menu back.
(How to hide navigation bar permanently in android activity?)
this doesn't work also(Permanently hide navigation bar on activity) (Is there a way to hide the system/navigation bar in Android ICS)
i also tried to disable navigation bar actions using onKeyDown but it didn't work on all of the keys.
in addition i want to remove the notification bar which make the user access the settings of the device and other things..
and this not working also (Disable the notification panel from being pulled down) as mentioned in this link it doesn't solve it, it just hides it after showing it :S
help would be appreciated,
Thanks.
You can get a kiosk type mode in Android 5.0, using the screen pinning feature mentioned here:
Android 5.0 introduces a new screen pinning API that lets you
temporarily restrict users from leaving your task or being interrupted
by notifications. This could be used, for example, if you are
developing an education app to support high stakes assessment
requirements on Android, or a single-purpose or kiosk application.
Once your app activates screen pinning, users cannot see
notifications, access other apps, or return to the home screen, until
your app exits the mode.
You can lock the device down to be a kiosk. The navigation bar is not hidden, but the home and recents buttons can be removed or disabled depending how you activate the mode. I wrote some information after testing this feature here.
Its possible
To disable the Status NotificationBar:
You need to place a view on top of the notification bar, so that we hijack the touch events to the Status notification bar. Without further ado, here is the code:
mView= new TextView(this);
mView.setText(".........................................................................");
mLP = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
100,
// Allows the view to be on top of the StatusBar
WindowManager.LayoutParams.TYPE_SYSTEM_ERROR,
// Keeps the button presses from going to the background window
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
// Enables the notification to recieve touch events
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
// Draws over status bar
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
PixelFormat.TRANSLUCENT);
mLP.gravity = Gravity.TOP|Gravity.CENTER;
mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
mWindowManager.addView(mView, mLP);
And since you are using the system overlay window, you need the permission:
<uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" />
Note:
Do not make your app full screen, as the versions above 17, which supports immersive mode, will screw this approach.
You can NOT disable the system or notification panel in Android.
You can hide these elements (like you have already discovered), but currently, you can NOT disable them permanently.
You are looking for a 'Kiosk Mode' which is not supported.
The closest thing to what you are looking for is 'Immersive Mode' (details) - but this does NOT hide the settings or navigation controls permanently.
On a phone without hardware buttons, the soft keys bar looks like:
In some app (e.g. the browser), the soft keys bar is minimized and more screen space is available:
How can this be done?
Set your theme to be fullscreen, then build the controls yourself. The Up/Down arrow toggles the fullscreen mode.
I don't think it's a good idea to try to hide that bar, even if this could be done on some devices. It's obvious on most devices these keys are more like hardward key even accept touch input.
I'm currently working on an app for blind people. What I need is to prevent users from accidentally going outside of my app, so I'm trying to overlay/replace/hide soft buttons in Android 4. I know this must be possible because it is used for example in MXPlayer (you can "lock" screen when playing video).
I've tried to override all three buttons (back,home,recent apps). No problem with back and home, but I couldn't figure out how to override(disable) recent apps. I've tried solution described here without success.
Next idea was to overlay the entire screen. I've successfully created system overlay mentioned in this question, but I didn't find out how to overlay my soft buttons.
Do you have any idea how to solve this problem without rooting the phone and using custom ROM?
edit: I've also tried hiding the buttons with SYSTEM_UI_FLAG_LOW_PROFILE(turns buttons into dots) and SYSTEM_UI_FLAG_HIDE_NAVIGATION(hides buttons till next touch). Unfortunately this also doesn't solve my problem because after touch buttons work as usual. Maybe there's a way how to catch "unhiding" a override showing them again?
From Android docs :
The SYSTEM_UI_FLAG_LOW_PROFILE flag replaces the STATUS_BAR_HIDDEN flag. When set, this flag enables “low profile" mode for the system bar or navigation bar. Navigation buttons dim and other elements in the system bar also hide. Enabling this is useful for creating more immersive games without distraction for the system navigation buttons.
The SYSTEM_UI_FLAG_VISIBLE flag replaces the STATUS_BAR_VISIBLE flag to request the system bar or navigation bar be visible.
The SYSTEM_UI_FLAG_HIDE_NAVIGATION is a new flag that requests the navigation bar hide completely. Be aware that this works only for the navigation bar used by some handsets (it does not hide the system bar on tablets). The navigation bar returns to view as soon as the system receives user input. As such, this mode is useful primarily for video playback or other cases in which the whole screen is needed but user input is not required.