//sorisdk/com.iplateia.sorisdk/SORIAudioRecognizer/updateDatabase
updateDatabase
[androidJvm]
suspend fun updateDatabase(ctx: Context): UpdateResult
Updates the audio recognition database by checking for and downloading new audiopacks. This method can be called independently of the startRecognition method.
The method performs the following steps:
- Authenticates with the SORI API
- Checks if a database update is available
- Downloads the new audiopack if available
- Applies the update immediately if the recognition service is running
- Stores the update for later application if the service is not running
example usage:
kotlin
val recognizer = SORIAudioRecognizer("your_application_id", "your_secret_key")
CoroutineScope(Dispatchers.Main).launch {
val result = recognizer.updateDatabase(this@MainActivity)
if (result.success) {
if (result.updateAvailable) {
Log.d("SORI", "Database updated to version: ${result.currentVersion}")
} else {
Log.d("SORI", "Database is already up to date")
}
} else {
Log.e("SORI", "Database update failed: ${result.errorMessage}")
}
}
Return
UpdateResult containing the status of the update operation.
Parameters
androidJvm
ctx | The context from which the update is requested. |