Skip to main content

Set · Unset

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Put a checkbox or switch into a state, rather than toggling whatever it is in. These call app_set.

Set​

func (d *Device) Set(ctx context.Context, target string, value bool) error

Set puts a checkbox or switch into a state, rather than toggling it: value true checks it or turns it on, false clears it or turns it off.

Idempotent: asking for a state it is already in does nothing, which is what makes it safe to call without reading first. Anything with no checked state is refused rather than tapped, and a radio cannot be unset — a group is cleared by choosing a different member.

Unset​

func (d *Device) Unset(ctx context.Context, target string) error

Unset is Set(ctx, target, false): a checkbox cleared, a switch turned off.

Examples​

Tick a checkbox, whatever state it is in​

if err := dev.Set(ctx, "testid=termsCheck", true); err != nil {
return err
}

The same call from the command line, mobium set testid=termsCheck, printed on an Android 15 emulator:

testid=termsCheck is now checked
BeforeAfter
Before: mobium set testid=termsCheck on an Android 15 emulatorAfter: mobium set testid=termsCheck on an Android 15 emulator

mobium set testid=termsCheck on an Android 15 emulator

Turn a switch off​

if err := dev.Unset(ctx, "@e4"); err != nil {
return err
}

On a device​

BeforeAfter
Before: mobium unset testid=termsCheck on an Android 15 emulatorAfter: mobium unset testid=termsCheck on an Android 15 emulator

mobium unset testid=termsCheck on an Android 15 emulator