Skip to content

Instantly share code, notes, and snippets.

View AndrazP's full-sized avatar

Andraž Pajtler AndrazP

  • San Francisco, US
View GitHub Profile
@AndrazP
AndrazP / SpeechRecognizerErrorCodes.md
Created May 17, 2023 05:36
List of the most common Android SpeechRecognizer errors and what they mean.
Error constant Constant value What when wrong
ERROR_NETWORK_TIMEOUT 1 Network error.
ERROR_NETWORK 2 Network error.
ERROR_CLIENT 5 Very generic error.

We noticed it:
- On API levels 30 and older if the requested language is not supported or available.
- After cancelling with SpeechRecognizer.cancel().
ERROR_NO_MATCH 7 Returned if no speech was recognized during listening.
ERROR_RECOGNIZER_BUSY 8 Make sure you are not calling startListening before cancelling or waiting for a response.
ERROR_INSUFFICIENT_PERMISSIONS 9 Insufficient permissions. Make sure you requested microphone runtime permission.
ERROR_LANGUAGE_NOT_SUPPORTED 12 Can occur on API 31 and newer. The requested language is not supported.
ERROR_LANGUAGE_UNAVAILABLE 13 Can occur on API 31 and newer. The requested language is supported but not available, it's not downloaded.
@AndrazP
AndrazP / ASCIIFoldingFilter.kt
Created May 6, 2021 07:21
ASCIIFoldingFilter implementation in Kotlin. Original source code from Apache Lucene.
package me.direct4.business.util
/**
* This class converts alphabetic, numeric, and symbolic Unicode characters
* which are not in the first 127 ASCII characters (the "Basic Latin" Unicode
* block) into their ASCII equivalents, if one exists.
*
* Characters from the following Unicode blocks are converted; however, only
* those characters with reasonable ASCII alternatives are converted:
*
@AndrazP
AndrazP / activity_detail.xml
Last active August 6, 2017 17:12
Empty space in CollapsingToolbarLayout with android:fitsSystemWindows="true" and wrap_content height. Original: https://github.com/chrisbanes/cheesesquare/blob/master/app/src/main/res/layout/activity_detail.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~