简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM