androidkotlinwear-oskiosk-modesamsung-galaxy

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!


Solution

  • 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))