ADB on Kindles is there a way to receive a notification back when a window opens up or to see the checkbox status?

Viewed 13

I'm using adb event codes to setup and navigate thru over 200 kindles

adb -s %%i %*shell input keyevent 61"....

This works great for the first time thru but the second time thru, I could be turning off things that the prior run thru turned on or vice versa. Is there a way with adb commands to read status get feedback or otherwise check to see if a check box on the kindle has been set, or if a window pops up on the launcher screen. I'm not understanding how to query the device to see if things are flagged or otherwise set. Thanks

1 Answers

This is not exactly what you want, as this is enabling Wi-Fi on a phone instead of Parental Controls, but I think you can get some ideas from this example that might be useful.

Instead of blindly clicking on the switch that would toggle Wi-Fi ON and OFF, this only clicks if it is OFF

#! /usr/bin/env python3

from com.dtmilano.android.viewclient import ViewClient


helper = ViewClient(*ViewClient.connectToDeviceOrExit(), useuiautomatorhelper=True).uiAutomatorHelper

obj_ref = helper.ui_device.find_object(body={
                                         'clazz': 'android.widget.Switch',
                                         'pkg': 'com.android.settings',
                                         'desc': 'Wi‑Fi'
                                         })
if helper.ui_object2.dump(oid=obj_ref.oid).text != 'ON':
    print('Switching Wi-Fi ON')
    helper.ui_object2.click(oid=obj_ref.oid)
else:
    print('Wi-Fi already ON')

enter image description here

It's using AndroidViewClient/culebra with CulebraTester2-public back-end.

Related