🚀 Best-in-class Voice AI!
Build compliant and low-latency AI applications using React Native without sending user data to 3rd party servers.
Start Free

As voice technology continues to advance, wake word detection has become a key part of how we interact with devices. Instead of continuously processing all speech, a wake word allows an app or device to "wake up" only when you say a specific phrase, like "Hey AppName". This approach makes interactions feel natural and responsive while conserving device resources and enhancing user privacy.

The term wake word detection is often used interchangeably with hotword detection, keyword spotting, or voice triggers.

One of the biggest advances in technology today is on-device processing. Running wake word detection offline makes responses faster, keeps your audio private, and eliminates reliance on an internet connection. This is especially important for mobile devices, where connectivity can be spotty.

For developers, offline wake word detection unlocks exciting possibilities. Users can activate apps, smart devices, or workflows just by speaking a phrase—anywhere, anytime. It ensures voice interactions are reliable, consistent, and secure, no matter where you are.

This guide shows how to add custom, on-device wake word detection to a React Native app with Porcupine Wake Word.

What you'll learn:

  • Setting up audio recording permissions for iOS and Android
  • Adding custom wake word detection with Porcupine

What you need:

  • React Native 0.62.2+
  • Android 5.0+ (API 21+)
  • iOS 13.0+

Configure Microphone Permissions

Before we begin—integrating wake word detection requires recording audio, which means the user must grant permission. Set up your project to request and handle these permissions:

iOS Permissions

Add the following block to Info.plist:

Android Permissions

Add the following block to AndroidManifest.xml:

Internet is required only for licensing and usage tracking.

Add Wake Word Detection with Porcupine

  1. Install Porcupine React Native Dependencies: To use Porcupine Wake Word in your React Native project, install @picovoice/react-native-voice-processor and @picovoice/porcupine-react-native:
  1. Get Your Picovoice Access Key: Sign up for a free Picovoice Console account and obtain your AccessKey. The AccessKey is only required for authentication and authorization.

  2. Train Custom Keywords: Create a custom wake word using the Picovoice Console. Be sure to read our guide on choosing a wake word to ensure optimal performance.

If you'd like to see a video walkthrough for creating a wake word, check out Picovoice Console Tutorial: Porcupine Wake Word.

  1. Add Keyword Files to Your Project: Once you have chosen your keyword, you will need to download two keyword files—one for Android, and one for iOS. The files will have a .ppn extension. In the Android subproject, add the Android keyword file to the assets folder (${ANDROID_APP}/src/main/assets). In the iOS subproject, add the iOS keyword file to the Copy Bundle Resources step. In the following code examples, this file will be referred to as ${KEYWORD_FILE_PATH}.

  2. Using Non-English Model Files (Optional): The English model file is built into Porcupine, so if you trained an English keyword, you can skip this step. Otherwise, you will need the corresponding Porcupine model file. Similar to step 4, add this file to the assets folder for Android, and Copy Bundle Resources step for iOS. In the following code examples, this file will be referred to as ${MODEL_FILE_PATH}.

Step-by-Step Code Implementation

First, we'll break down the key components of the Porcupine React Native SDK. At the end is a fully implemented component that you can simply drop into your project for a quick proof of concept.

  1. Define a function to handle keyword detection. You can pass in more than one keyword, and the detection callback function will give you the index of the keyword detected. Also define an error handler callback.
  1. Create an instance of PorcupineManager. Be sure to replace the placeholders, and pass in your detectionCallback() and processErrorCallback() functions.
  1. To start listening for wake words, call start().
  1. To stop listening for wake words, call stop().
  1. Once you no longer need PorcupineManager, be sure to release the resources acquired by calling delete().

Complete Code Implementation

Below is a fully implemented component you can copy into your project to see Porcupine in action. Be sure to replace the placeholders ${ACCESS_KEY}, ${KEYWORD_FILE_PATH}, and ${MODEL_FILE_PATH} (if applicable).

To see a complete working project, check out Porcupine's React Native demo on GitHub. For more in-depth information, refer to the Porcupine React Native SDK quick start guide.

Next Steps: Adding Voice Commands

You've built wake word detection—now make it truly useful by adding voice commands. Once users say the wake word, they can immediately give instructions, creating a natural, seamless way to interact with your app. By combining the two, you'll deliver a truly hands-free experience that feels effortless and intelligent from the first word to the last.

Start Free

Frequently Asked Questions

Does Porcupine Wake Word Detection work offline?
Yes, Porcupine processes all voice data on-device without requiring an internet connection. Your React Native app can detect custom wake words even when completely offline, ensuring user privacy, eliminating cloud dependency, and providing consistent sub-second response times regardless of network conditions. Internet is only required for monthly licensing validation and usage reporting.
Can I use multiple wake words in the same React Native app?
Yes, Porcupine Wake Word can detect multiple wake words simultaneously in a single React Native app, even across different languages. This can be achieved simply by passing in an array of keywords when instantiating an instance of Porcupine, and instantiating a separate instance of Porcupine for each target language.
How does Porcupine Wake Word accuracy compare to competitors?
Porcupine achieves industry-leading wake word accuracy that exceeds the alternatives (97%+ detection at 1 false alarm per 10 hours.) To help developers make informed decisions, Picovoice published an open-source wake word accuracy benchmark that has been widely accepted by researchers and the voice AI community.

Due to the nuances of wake word benchmarking, Picovoice also published detailed guides explaining how to benchmark a wake word engine and how to verify wake word vendors' claims. These resources enable developers who are not familiar with the voice AI to independently evaluate Porcupine's performance and compare it against any other solution using standardized metrics.