KeenASR React Native Plugin (v2.2)
    Preparing search index...

    Interface ASRResponse

    Complete ASR response from a recognition session.

    An ASRResponse is emitted via the onFinalResponse event when recognition completes. It contains the recognition result, audio quality metrics, and metadata about the session.

    Important: Each response holds a reference to native memory. You must call release() when you are done with the response to free native resources.

    const unsubscribe = onFinalResponse((response) => {
    console.log(response.asrResult.text);
    console.log(response.audioQualityResult.snrValue);

    // Release native memory when done
    response.release();
    });
    interface ASRResponse {
        id: string;
        asrResult: ASRResult;
        audioQualityResult: ASRAudioQualityResult;
        decodingGraph: string;
        asrBundle: string;
        appBundleId: string;
        echoCancellation: boolean;
        duration: number;
        startTime: string;
        audioFilename: string;
        jsonVersion: number;
        sdkVersion: string;
        deviceInfo: Record<string, unknown>;
        setCustomJson: (json: string) => Promise<boolean>;
        queueForUpload: () => Promise<boolean>;
        saveJsonFile: (directoryPath: string) => Promise<boolean>;
        saveAudioFile: (directoryPath: string) => Promise<boolean>;
        release: () => void;
    }
    Index

    Properties

    id: string

    Unique response identifier (UUID assigned by the SDK).

    asrResult: ASRResult

    Recognition result containing text, words, and optional phone-level scores.

    audioQualityResult: ASRAudioQualityResult

    Audio quality metrics for the recording.

    decodingGraph: string

    Name of the decoding graph used for this recognition session.

    asrBundle: string

    Name of the ASR bundle used for this recognition session.

    appBundleId: string

    App bundle identifier (e.g., com.example.myapp).

    echoCancellation: boolean

    Whether echo cancellation was enabled during this session.

    duration: number

    Duration of the recorded audio in seconds.

    startTime: string

    Start time of the recording as an ISO 8601 string.

    audioFilename: string

    Filename of the recorded audio.

    jsonVersion: number

    JSON format version number.

    sdkVersion: string

    KeenASR SDK version string.

    deviceInfo: Record<string, unknown>

    Device information dictionary.

    setCustomJson: (json: string) => Promise<boolean>

    Set a custom JSON object to be merged into this response's JSON representation when it is saved or uploaded.

    Each call replaces any previously set custom JSON. The input must be a well-formed JSON string (object or value); pass the result of JSON.stringify(...). Returns false (without modifying the response) if the string is not valid JSON.

    Useful for attaching app-level metadata — user id, prompt id, lesson context, scoring results — that you want visible alongside the response in saved files and on the KeenASR Dashboard.

    Type Declaration

      • (json: string): Promise<boolean>
      • Parameters

        • json: string

          JSON string to merge into the response.

        Returns Promise<boolean>

        true if the JSON was accepted and stored.

    await response.setCustomJson(JSON.stringify({
    userId: 'user-123',
    lessonId: 'lesson-42',
    score: 0.87,
    }));
    queueForUpload: () => Promise<boolean>

    Queue this response for upload to the KeenASR Dashboard.

    The data uploader must be started first via startDataUploader.

    Type Declaration

      • (): Promise<boolean>
      • Returns Promise<boolean>

        true if the response was queued successfully.

    saveJsonFile: (directoryPath: string) => Promise<boolean>

    Save this response's JSON data to a file in the specified directory.

    Type Declaration

      • (directoryPath: string): Promise<boolean>
      • Parameters

        • directoryPath: string

          Absolute path to the directory where the JSON file will be saved.

        Returns Promise<boolean>

        true if the file was saved successfully.

    saveAudioFile: (directoryPath: string) => Promise<boolean>

    Save this response's audio recording to a file in the specified directory.

    Type Declaration

      • (directoryPath: string): Promise<boolean>
      • Parameters

        • directoryPath: string

          Absolute path to the directory where the audio file will be saved.

        Returns Promise<boolean>

        true if the file was saved successfully.

    release: () => void

    Release the native response handle and free associated memory.

    You must call this method when you are done with the response. After calling release(), the response object should not be used.