alert · answerAlert · pressAlertButton
This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET
Read a system dialog, or answer it. These call app_alert.
alert
public String alert()
What a system dialog says, or an empty string when none is up.
A permission prompt is another process's window, not the app's, and reading it needs no knowledge of what the buttons say.
@return the dialog's text, or an empty string when none is up
answerAlert
public void answerAlert(boolean accept)
public void answerAlert(boolean accept, String text)
Accepts or dismisses a dialog of one or two buttons.
accept is yes and dismiss is no, so a two-button permission prompt is
granted by accept and denied by dismiss, in any language. A dialog of
three or more is refused, naming its buttons — more than one may mean
yes, as on iOS's location prompt — so press one with
pressAlertButton(String).
@param accept true to accept, false to dismiss
Types into a dialog's field, then accepts or dismisses it, in one call.
A plain alert has no field, and the platform refuses the text. What
accept and dismiss press is as for answerAlert(boolean).
@param accept true to accept, false to dismiss @param text what to type into the prompt's field first
pressAlertButton
public String pressAlertButton(String button)
public String pressAlertButton(int position)
Presses a dialog's button by its caption, on any dialog — one of three buttons or an app's own included. A caption matches in any case and with straight or curly quotes.
@param button the caption, as a read of the dialog lists it @return the caption pressed
Presses a dialog's button by its position from 1, in the order the dialog shows them, which does not depend on the device's language.
@param position the button's position, from 1 @return the caption pressed
Examples
Ask whether a dialog is up, what it says, and its buttons
String says = device.alert(); // "" when no dialog is up
if (!says.isEmpty()) System.out.println(says);
The same call from the command line, mobium alert, printed on an Android 15 emulator:
a dialog is on screen: "Discard changes?\nThey will be lost."
buttons: "KEEP EDITING", "DISCARD"

mobium alert on an Android 15 emulator
Say yes to a dialog of one or two buttons
device.answerAlert(true);
The same call from the command line, mobium alert accept, printed on an Android 15 emulator:
accepted the dialog "Discard changes?\nThey will be lost.": pressed "DISCARD"
| Before | After |
|---|---|
![]() | ![]() |
mobium alert accept on an Android 15 emulator
Press a button by its caption, on a dialog of three
String pressed = device.pressAlertButton("Don't Save");
System.out.println("pressed " + pressed);
The same call from the command line, mobium alert --button "Don't Save", printed on an Android 15 emulator:
pressed "DON'T SAVE" on the dialog "Save this draft?\nYou can come back to it later."
| Before | After |
|---|---|
![]() | ![]() |
mobium alert --button "Don't Save" on an Android 15 emulator
More examples
Fill a prompt's field and accept it, in one call
device.answerAlert(true, "Groceries");



