I´m trying to configure a Android Single Use app. I´m using a Huawei P8 Lite with Android 6.0 and a Samsung Galaxy A3 2017 with Android 6.0. I´ve set the app to Device Owner and everything works well. I´ve deactivated Toast messages via adb and set the home button to the app. So everything works fine. When I start the app you can´t leave it anymore, even with a restart. But now there are 2 problems left. On the Samsung it works fine to deactivate Toast messages with the adb code
adb shell appops set android TOAST_WINDOW deny
but on the Huawei it does not work. It doesn´t show an error.
The second problem I got with the Samsung. When I restart the Huawei and press the "Home" Button I get directly into the app without having to swipe at the lockscreen. When I open the app at the Samsung it´s the same, but after a restart I always get into the lockscreen before entering the app. This is a little problem because it´s possible to open the dropdown menu with swiping down. The buttons there do not work but I want to get directly into the app when I press the Home or Power button.
So my Questions are: - How to deactivate the toast messages on the Huawei? - How to deactivate the whole lockscreen on the Samsung?
Anyone got an idea?
Thanks
To bypass the lockscreen on the Samsung, you can try wake up the device by launching an activity as soon as the device starts, with the following flags
this.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD |
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON,
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD |
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
copied from how to wakeup android phone from sleep?. Just make sure that you have chosen "None" as a screen lock type or called setKeyguardDisabled, which has the same effect.
To deactivate toast you need root privilege, so your device needs to be rooted and you need to do
adb root & adb shell appops set android TOAST_WINDOW deny