I am trying to build an android app in kiosk-mode in Android 4.2.2 (Jelly Bean). What I have achieved till now is to make the application as full screen and also handled the home and back buttons. However, my problem is, I want to remove the status/notification bar. I don't want the user to access any other settings through it. I have tried out many ways including the usage of different flags available in android WindowManager for having a screen devoid of the notification bar. However, none were helpful for that.
I have read about apps like Surelock which serve this purpose. Therefore, at least I know that there is something which can be done, except rooting, to remove the notification bar.
Can anyone please help me on this?
Related
I'm trying to create a custom lockscreen for Android version 7.1.1. (Nougat). I know that there are a lot answers on how to create a custom lockscreen, but whatever code I try to use, it's not really working.
The problem appears because of using deprecated methods. The app crushes, and there are no methods to replace the deprecated ones.
Does anyone know a way that this still works?
These are some of the links I've tried to use (there were a few older ones also but I didn't save them):
how to make our own lock screen in android instead of default lock screen
https://github.com/thomasvidas/Simple-Lockscreen/tree/master
developing an android lock screen application
Create custom lockscreen for android 4.0 or above?
At the end I managed to make this app working. My biggest problem was to put my device in kiosk mode (disabling hardware buttons when the lockscreen is displayed). The solution that worked for me was enabling device owner mode using Android Debug Bridge. It wasn't the best solution, but it was the most acceptable one for this project.
Here are some of the links that I used to achieve this:
https://documentation.meraki.com/SM/Device_Enrollment/Enabling_Device_Owner_Mode_using_Android_Debug_Bridge_(ADB)
http://www.sureshjoshi.com/mobile/android-kiosk-mode-without-root/
I have a custom rooted android tablet working on Android M version. We built a kiosk application and next step is removing navigation bar completely, while our application is working. Also, when administrator close our application, navigation bar should appear again.
Before asking this question, I researched on Internet and find a lot of people have this problem. However, answers to theirs question were generally, making application to work in full-screen mode or in immersive full-screen mode.
These answers didn't help me at all, because user still can fling on screen and navigation bar would show again. These solutions are probably the best that can be done with an unrooted device, but in my case I need a better solution and my device is rooted.
Also, I saw this answer link, but after using this command my desktop went black, and couldn't reboot android system again. Happily I have recovery USB so my device is working again. :)
I found another answer link, and like others, didn't help me because I need to reboot system after adding line of code (qemu.hw.mainkeys = 1). Also, solution that I looking for is fully dynamical and done by code.
I am really convinced that this isn't mission impossible, because we had old tablet (also rooted) with button in back, which can hide and show navigation bar without rebooting it.
Any help is appreciated.
I can't help you with your problem, but provide a little more information.
The company im working for is using devices in kiosk mode, but we have custom android devices from a hardware producer, which provides a custom HAL interface. We can set the kiosk mode via that interface.
My guess is it cant be done easily, if it was easy, we would have not gone that way. Hope it helps.
I am developing an Application where I need to go completely full screen. In kitkat its very easy by using Immersive tag. But since not all devices support kitkat I need to take JB and ICS (atleast) into consideration.
Well although there is a way of hiding navigation bar and status bar in JB and ICS it becomes visible as soon as the user interacts. This certainly does not looks good. It also takes one extra touch.
I did a lot of searching on net and was surprised that there is no way we can achieve it. I was hoping to find some trick or hack but nothing.
I am pretty sure that before kitkat came there were games which used full screen so I guess there should be a way (like Temple Run and Andgry Birds). Can some one please guide me in correct direction.
P.S: I am looking solution for devices which are not rooted.
Thanks :)
Use a full screen theme, or set it from code as described here https://developer.android.com/training/system-ui/status.html
As I already pointed out in the comments, this will give you full screen. Not the immersive mode as seen on KitKat where the user can easily unhide the status bar. If you're going with the theme approach it's probably best to set a not full screen theme on API19+ (KitKat) and tell it to use Immersive mode from there on.
I will give my ICS tablets for users to complete a survey so I would like the user to work with my app only. They should not be able to switch to the home screen, press back buttons etc., so I would like to hide the system bar completely.
My tablet is rooted and I know some application like
this can help me, but I don't need all the extra functions of this app.
I found this tutorial that could help me, but if I can add the code to do my own, it would be great.
After a lot of searching on the internet, I managed to get the System Bar to hide and appear in a 4.2 device using:
To Hide:
Runtime.getRuntime().exec("service call activity 42 s16 com.android.systemui");
Or use 79 instead of 42 for API less than 14. You may also need to include the SET_DEBUG_APP permission, in which case you need to have the application signed with the system key or installed in the /system/app/ directory.
To Show:
Runtime.getRuntime().exec("am startservice --user 0 -n com.android.systemui/.SystemUIService");
Alternatively some people have used the -a (instead of -n) option, though this was causing an error on my device:
Error: Not found; no service started.
For Android 4.4, there is a new feature called immersive mode which hides both the system and status bars. The system UI is toggled by the user through the use of an edge swipe from the top or bottom of the screen. For more details take a look at:
http://developer.android.com/reference/android/view/View.html#setSystemUiVisibility(int)
Using new IMMERSIVE mode in android kitkat
For example:
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)
HideBar has a kiosk mode especially for this use case.
A free download is available at http://ppareit.github.com/HideBar/.
You can also find it in the market at https://play.google.com/store/apps/details?id=be.ppareit.hidebar.
If you want to incorporate it in your own test/survey application you can always contact the developer (see the links for an email). The code could be explained or an Intent to do the hiding could be provided.
check this link: (requires root)
http://android.serverbox.ch/?p=306
similar question was posted here also:
Is there a way to hide the system bar in Android 3.0? It's an internal device and I'm managing navigation
or try HideBar
http://ppareit.github.com/HideBar/
Actually you can simply put the system bar in "lights out" mode, the system bar buttons and notifications gets dimmed.
View v = findViewById(R.id.view_id);
v.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
I want to add some information to the existing replies hoping it will be useful for someone.
To get a real full screen working on my low cost China tablets I need to edit a file located in
system/build.prop
replace the text
ro.property.tabletUI=true
with
#ro.property.tabletUI=true
(I comment the line). After that, I can get a full screen using
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen"
for each activity in the minfest.xml
This solution Is good only if you sell tablets with your application and needs root privileges to edit the system/build.prop. So it's not a solution for all, so please do not downvote this little contribute.
EDIT:
I noticed that my tablets have hardware buttons (Home, menĂ¹ and back) on the frames. So Android lets me to hide the system bar. I tryed with other tablets that haven't hardware buttons without success.
Google intends Android to be used for consumers only. They integrated the System UI bar more tightly into Android ICS (4.0) to prevent people from rooting the device and killing the bar that way. Attempting to delete the system bar process will prevent the OS from booting fully.
If you want to restrict users from accessing the home screen, then you are out of luck with Android ICS. I would suggest finding a tablet manufacture who will preload the device with Android 2.3. Either that, or use a rooted Android 3.x device.
If you intend to use Android for kiosk or locked down devices, then you would be better off targeting an OS that is a bit more open.
I found a solution that, in my use case, works like a charm by hiding the menu bar even on a NOT ROOTED device:
setting this flag
layoutparams.flags = 0x80000000 | layoutparams.flags;
to my window's layout parameters simply does the trick!
Here's the complete snippet i used:
Window window = getWindow();
android.view.WindowManager.LayoutParams layoutparams = window.getAttributes();
layoutparams.flags = 0x80000000 | layoutparams.flags;
window.setAttributes(layoutparams);
in my Activity onCreate.
To find out this I reverse engeneered a non-system Apk I found that was somehow able to do that.
According to the official documentation:
http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
that "0x80000000" is the FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS introduced as a system constant in Api level 21, and it basically indicates that "this Window is responsible for drawing the background for the system bars." and since i'm not manually drawing any system bar, no menu bar is shown.
I only tested this on a pair of Moverio BT-200 running Android ICS 4.0.3 because that is the device i'm currently working on and also because right now i don't have other device running Api levels prior to 19 under my hands to test it.
There is a workaround to disable menu bar (not hide) in all most all tablets without rooting. But this is bit tricky, but it works clean. Several well known apps in the market at the moment using this strategy to achieve this disable menu bar feature for their apps.
Grant admin privilege (need one time user involvement to activate).
Set password & lock the device using device admin profile api programatically.
Then load what ever the UIs on top of the native lock screen. (Of course this will show background lock screen whenever a transition happens between activities. But if logic is organized well, then it will be smooth & less noticed by the user)
When need to enable back, reset password to "" using resetPassword("", 0) of device policy manager object.
To complement the answers already given, and in case it is useful for someone needing a similar behaviour, there is this tutorial for android devices 4.0 and higher, it tells you how to hide the navigation bar and the status bar (they will reappear when the screen is touched again):
https://developer.android.com/training/system-ui/navigation.html
I realize it is not what you need exactly, but might be useful for someone else looking at this problem.
I'm trying to fake some information that are shown on the status bar (I'm doing this for a good reason, for example when a thief steels the phone, he doesn't deserve to know the status of anything: battery, WiFi, 3G, GPS, etc...)
I know that this is possible somehow without creating a ROM, see this app in the Android market: CSB Fake
at 2:26 in the video, he fakes the battery level IN THE STATUS BAR!
I really need to know how is this done.
There are only two ways I can think of
at some desired time, change the icon in the system (using superuser permission)
just send wrong information to the status bar, and it does the rest, for example, send to the status bar that the GPS is not working while in fact it is
Is it possible to do it without rooting? (that app seems to do it on no-rooted devices)
How to do such a thing? is there any references or some sites that most likely has the answer?
That screen shown in app for battery you can make that...by making the app full screen mode and show your custom title bar like with wifi level battery level time icons and also pop up one custom dialog for battery low as same as android pops up.
This must be done at build time. The reason for this is because the base level of android has the statusbar code. YOU MUST recompile the ROM there is NO way around this. These are system level broadcasts that are broadcasted within the phone. You cannot control this, even with root its still impossible.
Once again, to do this properly you MUST have code that will allow you to recompile your source code of your phone. A custom rom would suit this.