speakText()
Converts text to speech using Android’s Text-to-Speech (TTS) engine. This is the primary method for providing voice feedback during automation.The text to speak. Supports plain text only.
This function does not return a value.
Basic Usage
Practical Examples
Implementation Details
Source Location
MainActivity.kt:4936
TTS Engine
The function uses Android’s built-inTextToSpeech service, which:
- Initializes on app startup
- Supports multiple languages (based on device settings)
- Queues messages if multiple calls are made rapidly
- Requires
TextToSpeech.OnInitListenercallback
Speech synthesis is asynchronous. The function returns immediately while the device speaks in the background.
Best Practices
Keep messages concise
Keep messages concise
Short messages (under 10 words) are easier to understand and don’t delay automation flow.
Add delays after speech
Add delays after speech
If critical timing is needed, add a delay after
speakText() to ensure the message completes.Use for debugging
Use for debugging
Speech is invaluable for debugging automations on remote devices where you can’t see the screen.
Common Use Cases
Workflow Status
Announce each step of a multi-step automation:Debug Mode
Provide verbose feedback during development:User Notifications
Alert users to important events:Limitations
Related Functions
- delay() - Add pauses after speech
- schedule() - Schedule recurring voice announcements
- sendAgentEmail() - Alternative notification method