Skip to main content

Microphone Release

Development Example

To ensure voice recognition is always responsive the RealWear Device functions in an “always listening” state where it waits for the user to trigger a voice command that is registered with the WearHF service at that point in time.

Applications can still access audio while the WearHF service is listening thanks to an audio share mechanism built into WearHF.

This means that applications should be able to fully function alongside WearHF and voice recognition but an application may wish to request for WearHF to release the microphone, stopping WearHF from being able to access it.

When this happens the rest of the Android system will remain having access to the microphone, following the standard Android principles.

This feature should be used with caution as it will disable behavior that the user may be expecting such as removing all voice recognition.

private static final String ACTION_RELEASE_MIC =
private static final String ACTION_MIC_RELEASED =

private static final String EXTRA_SOURCE_PACKAGE =

private void takeMicrophone() {
Intent intent = new Intent(ACTION_RELEASE_MIC);
intent.putExtra(EXTRA_SOURCE_PACKAGE, getPackageName());

private void releaseMicrophone() {
Intent intent = new Intent(ACTION_MIC_RELEASED);
intent.putExtra(EXTRA_SOURCE_PACKAGE, getPackageName());

* Called when activity is paused - See Android docs
protected void onPause() {

// Make sure we release the microphone on pause

View Full Source Code