Speech recognition requires audio permissions.
Runtime Permissions
Since Android M (6.0), users must grant permissions at runtime. By default, calling Voice.start() will trigger the RECORD_AUDIO permission popup.
Ejected Expo Apps
If using an ejected Expo app, you may encounter a casting error when starting recognition. To resolve this, use expo-permission to request AUDIO_RECORDING before calling Voice.start():
import { Permissions } from "expo";
async componentDidMount() {
const { status } = await Permissions.askAsync(Permissions.AUDIO_RECORDING);
if (status !== "granted") {
// Handle permission denied
this.setState({showRecordButton: false});
} else {
this.setState({showRecordButton: true});
}
}
Google Speech Engine
On Android, ensure the device has a speech recognition engine installed (e.g., com.google.android.googlequicksearchbox). Users can install the Google Search App if it is missing.
import { Permissions } from "expo";
async componentDidMount() {
const { status } = await Permissions.askAsync(Permissions.AUDIO_RECORDING);
if (status !== "granted") {
// Handle permission denied
this.setState({showRecordButton: false});
} else {
this.setState({showRecordButton: true});
}
}