Stay organized with collections
Save and categorize content based on your preferences.
ModelDownloadListener
interface ModelDownloadListener
Listener for model download events. It makes RecognitionService
let callers know about the progress of model download for a single recognition request.
Summary
Public methods |
abstract Unit |
A network or scheduling error occurred.
|
abstract Unit |
Called by RecognitionService only if the download has started after the request.
|
abstract Unit |
Called when RecognitionService scheduled the download, but won't satisfy it immediately.
|
abstract Unit |
This method is called:
if the model is already available;
if the RecognitionService has started and completed the download.
Once this method is called, the model can be safely used to satisfy recognition requests.
|
Public methods
onError
abstract fun onError(error: Int): Unit
A network or scheduling error occurred.
Parameters |
error |
Int: code is defined in SpeechRecognizer Value is android.speech.SpeechRecognizer#ERROR_NETWORK_TIMEOUT , android.speech.SpeechRecognizer#ERROR_NETWORK , android.speech.SpeechRecognizer#ERROR_AUDIO , android.speech.SpeechRecognizer#ERROR_SERVER , android.speech.SpeechRecognizer#ERROR_CLIENT , android.speech.SpeechRecognizer#ERROR_SPEECH_TIMEOUT , android.speech.SpeechRecognizer#ERROR_NO_MATCH , android.speech.SpeechRecognizer#ERROR_RECOGNIZER_BUSY , android.speech.SpeechRecognizer#ERROR_INSUFFICIENT_PERMISSIONS , android.speech.SpeechRecognizer#ERROR_TOO_MANY_REQUESTS , android.speech.SpeechRecognizer#ERROR_SERVER_DISCONNECTED , android.speech.SpeechRecognizer#ERROR_LANGUAGE_NOT_SUPPORTED , android.speech.SpeechRecognizer#ERROR_LANGUAGE_UNAVAILABLE , android.speech.SpeechRecognizer#ERROR_CANNOT_CHECK_SUPPORT , or android.speech.SpeechRecognizer#ERROR_CANNOT_LISTEN_TO_DOWNLOAD_EVENTS |
onProgress
abstract fun onProgress(completedPercent: Int): Unit
Called by RecognitionService
only if the download has started after the request.
The number of calls to this method varies depending of the RecognitionService
implementation. If the download finished quickly enough, onSuccess()
may be called directly. In other cases, this method may be called any number of times during the download.
Parameters |
completedPercent |
Int: the percentage of download that is completed |
onScheduled
abstract fun onScheduled(): Unit
Called when RecognitionService
scheduled the download, but won't satisfy it immediately. There will be no further updates on this listener.
onSuccess
abstract fun onSuccess(): Unit
This method is called:
if the model is already available;
if the RecognitionService
has started and completed the download.
Once this method is called, the model can be safely used to satisfy recognition requests.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-04 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-04-04 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-04 UTC."]]