//sorisdk/com.iplateia.sorisdk/SORIAudioRecognizer
SORIAudioRecognizer
open class SORIAudioRecognizer(applicationId: String, secretKey: String)
The primary entry point for the SORI SDK that handles the audio recognition tasks.
It provides methods for authentication, updating audiopacks, manipulate listeners, and starting the recognition service.
example usage:
kotlin
val listener = object : ISoriListener {
override fun onCampaignFound(campaign: SORICampaign) {
// Handle the campaign found event
println("Campaign found: ${campaign.name}")
}
val sori = SORIAudioRecognizer("your_application_id", "your_secret_key")
sori.setListener(listener)
sori.startRecognition(this)
Parameters
androidJvm
applicationId | The application ID for the SORI SDK. |
secretKey | The secret key for the SORI SDK. |
Constructors
SORIAudioRecognizer | [androidJvm] constructor(applicationId: String, secretKey: String) Creates an instance of SORIAudioRecognizer. |
Types
Name | Summary |
---|---|
Companion | [androidJvm] object Companion |
HandleUrlException | [androidJvm] open class HandleUrlException(message: String) : Exception |
NotificationProvider | [androidJvm] interface NotificationProvider Interface for delegate an audio recognition service foreground notification. You can implement this interface to customize the notification. |
Properties
Name | Summary |
---|---|
locationProvider | [androidJvm] var locationProvider: ILocationProvider? |
metadataProvider | [androidJvm] var metadataProvider: IMetadataProvider? |
Functions
Name | Summary |
---|---|
clearState | [androidJvm] fun clearState(ctx: Context) Clears the match state of the SORI Audio Recognition Service. This method is useful to reset the state of the service. example usage: |
getServiceIntent | [androidJvm] fun getServiceIntent(ctx: Context, title: String? = "SORI Audio Recognizer", body: String? = "Listening...", icon: Int? = android.R.drawable.ic_menu_info_details): Intent Creates an intent to start the SORI Audio Recognition Service. This intent can be used to start the service from an activity or another component. example usage: |
handleActionURL | [androidJvm] fun handleActionURL(ctx: Context, campaign: SORICampaign) fun handleActionURL(ctx: Context, url: URL) fun handleActionURL(ctx: Context, url: String) Visits the actual action URL that retrieves from the API Server. |
setListener | [androidJvm] fun setListener(ctx: Context, listener: ISORIListener) Set the listener interface for SORI SDK events. It helps to subscribe to the useful events like campaign found, service state changes, etc. |
setLocationProvider | [androidJvm] fun setLocationProvider(provider: ILocationProvider) Set the location provider for the SORI SDK. |
setMetadataProvider | [androidJvm] fun setMetadataProvider(provider: IMetadataProvider) Set the metadata provider for the SORI SDK. |
startRecognition | [androidJvm] fun startRecognition(ctx: Context, title: String? = null, body: String? = null, icon: Int? = null) Starts the SORI Audio Recognition Service. example usage: |
stopRecognition | [androidJvm] fun stopRecognition(ctx: Context) Stops the SORI Audio Recognition Service. example usage: |