//sorisdk/com.iplateia.sorisdk/ISORIListener
ISORIListener
interface ISORIListener
Interface definition for callbacks to be invoked when SORI SDK events occur.
Implement this interface to receive notifications about service state changes, campaign detection, and network-related events. The SDK provides comprehensive callbacks for monitoring recognition progress and handling network resilience.
Core Callbacks
onReady()
: Service initialization completeonStateChanged()
: Service state transitionsonError()
: Error conditionsonCampaignFound()
: Successful campaign detection
Network Handling Callbacks
onNetworkError()
: Network failures during API callsonRequestQueued()
: Requests queued for delayed sending
Example Implementation
kotlin
class MyListener : ISORIListener {
override fun onReady() {
Log.d("SORI", "SDK is ready")
}
override fun onCampaignFound(campaign: SORICampaign) {
// Handle detected campaign
showCampaignDetails(campaign)
}
override fun onNetworkError(materialId: String, error: String) {
// Show user-friendly message about network issue
Toast.makeText(context, "Network unavailable. Will retry later.", Toast.LENGTH_SHORT).show()
}
override fun onRequestQueued(materialId: String, queueCount: Int) {
// Update UI to show pending requests
updatePendingIndicator(queueCount)
}
}
Since
1.0.0
See also
SORIAudioRecognizer.setListener |
SORICampaign |
SORIConfig |
Inheritors
SORIListener |
Functions
Name | Summary |
---|---|
onCampaignFound | [androidJvm] abstract fun onCampaignFound(campaign: SORICampaign) Called when the Audio Recognition Service detects a campaign based on the audio input. |
onError | [androidJvm] abstract fun onError(error: String) Called when the Audio Recognition Service encounters an error. |
onNetworkError | [androidJvm] open fun onNetworkError(materialId: String, error: String) Called when a network error occurs while posting activity to the SORI API. |
onReady | [androidJvm] abstract fun onReady() Called when the Audio Recognition Service is ready and started. |
onRequestQueued | [androidJvm] open fun onRequestQueued(materialId: String, queueCount: Int) Called when a request is queued for delayed sending due to network unavailability. |
onStateChanged | [androidJvm] abstract fun onStateChanged(state: String) Called when the Service State changes. |