androidPorcupine - Android Quick Start


  • Android (4.4+)


Picovoice Account & AccessKey

Signup or Login to Picovoice Console to get your AccessKey. Make sure to keep your AccessKey secret.

Quick Start


  1. Install Android Studio.

  2. Include mavenCentral() repository in the top-level build.gradle. Then add the following to the app's build.gradle:

dependencies {
// ...
implementation 'ai.picovoice:porcupine-android:${LATEST_VERSION}' // replace with latest version
  1. Add the following to the app's AndroidManifest.xml file to enable recording with an Android device's microphone:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />


Use the PorcupineManager Builder to create an instance of PorcupineManager that detects the included built-in wake words porcupine and bumblebee:

import ai.picovoice.porcupine.*;
PorcupineMananger porcupineManager = new PorcupineManager.Builder()
.setKeywords([Porcupine.BuiltInKeyword.PORCUPINE, Porcupine.BuiltInKeyword.BUMBLEBEE])
.build(context, wakeWordCallback);
PorcupineManagerCallback wakeWordcallback = new PorcupineManagerCallback() {
public void invoke(int keywordIndex) {
if (keywordIndex == 0) {
// porcupine detected
} else if (keywordIndex == 1) {
// bumblebee detected

Start audio capture and wake word detection with:


Stop with:


Free resources used by PorcupineManager:


Custom Keywords

Create custom keyword using the Picovoice Console. Download the custom wake word file (.ppn) and create an instance of PorcupineManager using the .setKeywordPaths build method:

PorcupineManager porcupineManager = new PorcupineManager.Builder()
.build(context, wakeWordCallback);

Non-English Languages

Use the corresponding model file (.pv), to detect non-English wake words. The model files for all supported languages are available on the Porcupine GitHub repository.

Pass in the model file using the setModelPath builder method to change the detection language:

PorcupineManager porcupineManager = new PorcupineManager.Builder()
.build(context, wakeWordCallback);


For the Porcupine Android SDK, we offer demo applications that demonstrate how to use the Wake Word engine on real-time audio streams (i.e. microphone input).


Clone the Porcupine repository from GitHub using HTTPS:

git clone --recurse-submodules


  1. Open the Android Activity demo using Android Studio.
  2. Copy your AccessKey from Picovoice Console into the ACCESS_KEY variable in
  3. Run the application using a connected Android device or using an Android simulator.

The demo detects the chosen keyword only when the application is in focus. To run the demo in the background or use in conjunction with Android's Speech-To-Text API, head over to our Github repository.






Further Reading

Issue with this doc? Please let us know.