Closed wired87 closed 8 months ago
React Native
3.0.2
React Native 0.71
Android
Android 13+
Hey im facing the same issue as described here: https://github.com/Picovoice/porcupine/issues/1027 Im also (try) using Expo with Porcupine.
"expo": "~49.0.15",
Here is my code (followed the docs): `
`
let porcupineManager: PorcupineManager | undefined = undefined;
export const startListening = async () => { try { if (!porcupineManager) { console.log("Creating new PorcupineManager instance") porcupineManager = await PorcupineManager.fromBuiltInKeywords( PORCUPINE_API_KEY, [BuiltInKeywords.JARVIS], (keyword:number) => { console.log("Detected Keyword!"); // Code to run after Keyword detection }, () => {} ); } await porcupineManager?.start(); }catch (e:unknown) { if (e instanceof Error) { console.error("Error while listening occurred", e); } } };
export const stopListening = async () => { if (porcupineManager) { await porcupineManager.stop(); porcupineManager = undefined; } };
const detectedKeyWord = async ( detected: boolean, setDetected: Dispatch<SetStateAction> ) => { if (detected) { return } setDetected(true); // start processing
} `
On my Screen Component: // VOICE LISTENER LOGIC useEffect(() => { if (route.name === "EX1" || route.name === "EX2") { startListening() .then(() => { console.log("Start listening..."); } ) }else { stopListening() .then(() => { console.log("Route name changed Stop Listening..."); } ) } }, [route.name]);
UPDATE: I JUST FORGOT TO REBUILD THE APPLICATION! NOW EVERYTHIING IS WORKING THIS ISSUE CAN BE CLOSED!
1. Played around with some BuiltInKeywords 2. reinstalled the pckg
It should start liatening
I'm glad you found a solution to your issue!
I'm glad you have developed such a fantastic piece of Software. Thank you!
Have you checked the docs and existing issues?
SDK
React Native
Porcupine package version
3.0.2
Framework version
React Native 0.71
Platform
Android
OS/Browser version
Android 13+
Describe the bug
Hey im facing the same issue as described here: https://github.com/Picovoice/porcupine/issues/1027 Im also (try) using Expo with Porcupine.
"expo": "~49.0.15",
Here is my code (followed the docs):
`
let porcupineManager: PorcupineManager | undefined = undefined;
export const startListening = async () => { try { if (!porcupineManager) { console.log("Creating new PorcupineManager instance") porcupineManager = await PorcupineManager.fromBuiltInKeywords( PORCUPINE_API_KEY, [BuiltInKeywords.JARVIS], (keyword:number) => { console.log("Detected Keyword!"); // Code to run after Keyword detection }, () => {} ); } await porcupineManager?.start(); }catch (e:unknown) { if (e instanceof Error) { console.error("Error while listening occurred", e); } } };
export const stopListening = async () => { if (porcupineManager) { await porcupineManager.stop(); porcupineManager = undefined; } };
const detectedKeyWord = async ( detected: boolean, setDetected: Dispatch<SetStateAction>
) => {
if (detected) {
return
}
setDetected(true);
// start processing
} `
On my Screen Component: // VOICE LISTENER LOGIC useEffect(() => { if (route.name === "EX1" || route.name === "EX2") { startListening() .then(() => { console.log("Start listening..."); } ) }else { stopListening() .then(() => { console.log("Route name changed Stop Listening..."); } ) } }, [route.name]);
UPDATE: I JUST FORGOT TO REBUILD THE APPLICATION! NOW EVERYTHIING IS WORKING THIS ISSUE CAN BE CLOSED!
Steps To Reproduce
1. Played around with some BuiltInKeywords 2. reinstalled the pckg
Expected Behavior
It should start liatening