Collect intentional input and preserve user control.
1. Microphone access
Request permission in context and show active recording. Handle denial and stop capture when the user leaves or explicitly ends the session.
2. Push-to-talk and VAD
Push-to-talk gives explicit boundaries; voice activity detection estimates them. Noise and long pauses can cause false starts or early endings, so evaluate the chosen interaction.
3. Audio format
Match encoding, sample rate and channels to the recognition service. Bound buffering and handle audio focus changes without silently recording through an interrupted session.
Worked scenario
A noisy fan triggers VAD repeatedly. Push-to-talk provides a useful fallback for that environment.
Apply it
Implement a recording state machine and test permission denial, silence, noise and user cancellation.
Check your understanding
The user can always tell whether the app is recording. Explain the decision and show evidence from your implementation or design. If you cannot demonstrate it yet, revisit the relevant section before continuing.