Android:Disable popup window when entering kiosk mode - android

I have an Android application which uses Kioskmode. When the app start the screen below appears. My question is : Can I disable displaying the screen below that the screen is pinned ? I do not want to display the overlay when entering kiosk mode.

Yea that's possible. You'll need to make your App a device owner for this purpose.
Set up Admin Receiver in manifest
Run: adb shell dpm set-device-owner com.package.name/.AdminReceiver
Look here:
http://wenchaojiang.github.io/blog/realise-Android-kiosk-mode/ - really helpful
https://sureshjoshi.com/mobile/android-kiosk-mode-without-root/
https://developer.android.com/work/dpc/dedicated-devices/cookbook#java - if you want to make you kiosk mode app more secure

Related

WIFI not getting open when application in KIOSK Mode. Wear OS

I am developing a KIOSK Mode stand alone application for Wear OS(Samsung Watch 4, Wear OS 3.5). For KIOSK mode I am using device owner permission using ADB and used device [DevicePolicyManager][1] class to handle hardware button and status bar etc.
My Issue is, I am not able to open System WIFI settings which navigate to outside of KIOSK mode.
Just for your information I can open system bluetooth settings without disabling KIOSK mode. One more information: case 3 code work perfectly if your KIOSK mode is disable
I tried:
Case1.
context.startActivity(Intent("com.google.android.clockwork.settings.connectivity.wifi.ADD_NETWORK_SETTINGS"))
I can see something gets opened and closed automatically.
Case 2.
val intent = Intent(Settings.ACTION_WIFI_SETTINGS)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
intent.addCategory(Intent.CATEGORY_LAUNCHER)
startActivity(intent)
Case 3.
startActivity(Intent(Settings.ACTION_WIFI_SETTINGS))
If any one have any idea or workaround. Much appreciate your inputs!
Finally I achieved it by whitelisted packagename.
devicePolicyManager!!.setLockTaskPackages(deviceAdmin, arrayOf("our.own.package.name","com.google.android.apps.wearable.settings"))
After whitelisted in KIOSK mode. now it will work!
startActivity(Intent(Settings.ACTION_WIFI_SETTINGS))

adb - Script to add PIN but not secure start-up

I'm trying to write a shellscript to create android emulators programatically (OS version >= 7.1.1), and I want those emulators to have a PIN but not "secure start-up".
Note that "secure start-up" is not the "lock screen" and also not the screen to unlock an encrypted device.
The secure start prevents android from booting without first inserting the PIN; lock screen is what appears after the boot up has finished.
Here's the description that shows up on Android 8.1 when you set the PIN manually on the emulator:
And what shows up when the emulator starts with the secure start-up activated:
I only managed to insert the PIN using the command:
adb -s <emulator_name> shell locksettings set-pin 1111
but this also activates the secure-start and I didn't find a way to deactivate it.
Do you know a command to deactivate only the secure-start and not the PIN? Thanks!

Android - "set-device-owner" with non rooted device

We have to create a kiosk mode android app.
The app is ready, we need only to set kiosk mode.
We want to set the "set-device-owner" programmatically but our tablet is not rooted.
We don't want use ADB because this can be hard to explain to our customer.
Is there another way to enable it?
You can use QR code provisioning to get device owner privilege.
After factory reset on the welcome screen, tap Welcome 6 times to enter QR code provisioning mode. Here you can scan your QR code that is generated using the following code to activate device owner.
{"android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "in.test.mdm/in.test.mdm.AdminReceiver", "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM": "AVMYPJsNa1nCkf0jdWPEY7x_wnfYaIh1ouWuq10rYZY", "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "https://drive.google.com/uc?id=1XqplR-QKO_iUqdm6RAjAPeAAGwoI6uFj&export=download", "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED":true,"android.app.extra.PROVISIONING_SKIP_ENCRYPTION":true,"android.app.extra.PROVISIONING_ADMIN_EXTRAS_BUNDLE":{"test":"test" } }
You can generate a qr code by pasting the above text in any qr code generator site for example : https://www.the-qrcode-generator.com/

setting android wear watch device owner

We are creating an app for android watch (in my case sony 3) that needs a kiosk mode.
Using
adb shell
dpm set-device-owner com.example/.MyDeviveAdminReceiver
I get
Can't set package com.example as device owner.
using
db shell pm list features
I get
feature:reqGlEsVersion=0x20000
feature:android.hardware.bluetooth
feature:android.hardware.bluetooth_le
feature:android.hardware.faketouch
feature:android.hardware.location
feature:android.hardware.location.gps
feature:android.hardware.microphone
feature:android.hardware.screen.portrait
feature:android.hardware.sensor.accelerometer
feature:android.hardware.sensor.compass
feature:android.hardware.sensor.gyroscope
feature:android.hardware.sensor.light
feature:android.hardware.sensor.stepcounter
feature:android.hardware.sensor.stepdetector
feature:android.hardware.touchscreen
feature:android.hardware.touchscreen.multitouch
feature:android.hardware.type.watch
feature:android.hardware.usb.accessory
feature:android.hardware.wifi
feature:android.software.home_screen
feature:android.software.live_wallpaper
feature:android.software.voice_recognizers
feature:com.sonymobile.watch
Does anyone has an experiance own creating a device owner app for android wear watch ?
Haven't tried this with wearables, but most of the times I got errors setting up DeviceOwner through adb was due to an existing google account on the device, meaning it is already provisioned. Device Owner setup requires the device to not be fully provisioned.
More on this: How do you un-provision a device in order to set the Device Owner?

Programmatically enable/disable "Battery Saver" mode

I am trying to find if I can enable and/or disable Android's built-in "Battery Saver" mode programmatically.
Any official approaches, or trickery, are welcome.
For reference, here is how to do it following Android's standard UI in 5.0:
http://www.androidcentral.com/android-50-lollipop-basics-how-get-more-life-between-charges-battery-saver
I am aware you can detect it -- that is not what I am after.
Thanks all.
You can enable/disable Battery Saver programmatically on rooted devices. You have to edit the low_power value in global table, in /data/data/com.android.providers.settings/databases/settings.db file.
If your device supports settings command, you can execute (as root):
settings put global low_power 1
to enable Energy Saver and
settings put global low_power 0
to disable it.
If it doesn't, use sqlite3 command:
sqlite3 /data/data/com.android.providers.settings/databases/settings.db "update global set value='1' where name='low_power';"
sqlite3 /data/data/com.android.providers.settings/databases/settings.db "update global set value='0' where name='low_power';"
Remember that you have to unplug your phone from PC first, otherwise system will disable Energy Saver. Use ADB over WiFi or Android Terminal (Emulator).
UPDATE:
The sqlite3 method doesn't seem to be reliable anymore.
I'm not sure if android.os.action.POWER_SAVE_MODE_CHANGED broadcast gets send. Maybe you have to send it manually, like in code from here:
private static String COMMAND_ENABLE = "settings put global low_power 1\n" +
"am broadcast -a android.os.action.POWER_SAVE_MODE_CHANGED --ez mode true\n";
private static String COMMAND_DISABLE = "settings put global low_power 0\n" +
"am broadcast -a android.os.action.POWER_SAVE_MODE_CHANGED --ez mode false\n";
Also, it's been reported that a new power_saving entry appeared in settings database, however in Android 6.0.1 I haven't managed to find it. In Android 7.1.1_r13 low_power is still used internally (e.g. here), however it may get changed in some Android release. You may want to keep checking changes in e.g. this and this file.
You cannot without rooting your phone. I am not sure why this is the case, especially where location services are required now for viewing scan results since SdkVersion 23+ .
This issue is very revealing.
https://code.google.com/p/android/issues/detail?id=185370
The best answer is application developers are being forced to crowd source network location for their google overlords. Notice, the OS itself has no problem displaying scan results without location services on.
Revealing that there is no way to turn on location services without GPS where location services are inactive. This two step shuffle is a major quality of experience issue for users. Turn location services on, then turn GPS off.
Watch this space, more lock downs on the way.

Categories

Resources