DaVoice Integration Guides

Step-by-step guides to integrate wake word detection into your applications across all major platforms

New to voice activation? Read what a wake word is and how wake word detection works before choosing an integration path.

React Native Integration Guide

📦 Repository

GitHub: https://github.com/frymanofer/ReactNative_WakeWordDetection

Complete React Native SDK with native bridge for iOS and Android platforms.

Step 1: Installation

# Using npm
npm install react-native-davoice

# Using yarn
yarn add react-native-davoice

# iOS only - install pods
cd ios && pod install && cd ..

Step 2: Platform Configuration

iOS Configuration

Add microphone permission to ios/YourApp/Info.plist:

<key>NSMicrophoneUsageDescription</key>
<string>We need microphone access for wake word detection</string>

Android Configuration

Add permissions to android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />

Update android/app/build.gradle:

android {
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 33
    }

    packagingOptions {
        pickFirst 'lib/x86/libonnxruntime.so'
        pickFirst 'lib/x86_64/libonnxruntime.so'
        pickFirst 'lib/armeabi-v7a/libonnxruntime.so'
        pickFirst 'lib/arm64-v8a/libonnxruntime.so'
    }
}

Step 3: Basic Implementation

import React, { useEffect, useState } from 'react';
import { View, Text, Button, PermissionsAndroid, Platform } from 'react-native';
import DaVoice from 'react-native-davoice';

export default function App() {
  const [isListening, setIsListening] = useState(false);
  const [lastDetection, setLastDetection] = useState(null);

  useEffect(() => {
    requestPermissions();

    return () => {
      DaVoice.stopListening();
    };
  }, []);

  const requestPermissions = async () => {
    if (Platform.OS === 'android') {
      const granted = await PermissionsAndroid.request(
        PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
        {
          title: 'Microphone Permission',
          message: 'This app needs access to your microphone for wake word detection',
          buttonNeutral: 'Ask Me Later',
          buttonNegative: 'Cancel',
          buttonPositive: 'OK',
        }
      );
      return granted === PermissionsAndroid.RESULTS.GRANTED;
    }
    return true;
  };

  const startListening = async () => {
    try {
      await DaVoice.initialize({
        modelPath: 'assets://hey_jarvis.onnx', // Your wake word model
        threshold: 0.97,
        bufferCount: 3,
      });

      DaVoice.startListening((event) => {
        console.log('Wake word detected!', event);
        setLastDetection(new Date().toLocaleTimeString());
        // Handle wake word detection
        // e.g., navigate to voice command screen
      });

      setIsListening(true);
    } catch (error) {
      console.error('Error starting wake word detection:', error);
    }
  };

  const stopListening = () => {
    DaVoice.stopListening();
    setIsListening(false);
  };

  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <Text style={{ fontSize: 24, marginBottom: 20 }}>
        DaVoice Wake Word Detection
      </Text>

      {lastDetection && (
        <Text style={{ marginBottom: 20 }}>
          Last detection: {lastDetection}
        </Text>
      )}

      <Button
        title={isListening ? 'Stop Listening' : 'Start Listening'}
        onPress={isListening ? stopListening : startListening}
      />
    </View>
  );
}

Step 4: Adding Custom Wake Word Models

Place your custom .onnx model files in the assets folder:

  • iOS: Add model to Xcode project → Copy Bundle Resources
  • Android: Place in android/app/src/main/assets/

✅ Next Steps

  • • Test on both iOS and Android devices
  • • Adjust threshold for your environment (0.90-0.99)
  • • Implement background mode for always-on detection
  • • Add speech-to-text after wake word detection

Need Help Getting Started?

Our team provides free integration support and custom wake word training for all platforms.

Free Development Support • Code Examples • Community Discord • 1-2 Week Custom Model Turnaround