Class SORIAudioRecognitionService
-
- All Implemented Interfaces:
-
android.content.ComponentCallbacks,android.content.ComponentCallbacks2
public class SORIAudioRecognitionService extends ServiceForeground service that handles audio recognition tasks.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classSORIAudioRecognitionService.LocalBinder
-
Field Summary
Fields Modifier and Type Field Description public final static StringTAGprivate final StringCHANNEL_IDprivate NotificationChannelnotificationChannelprivate AfpMatchermatcherprivate SORIApiClientapi
-
Constructor Summary
Constructors Constructor Description SORIAudioRecognitionService()
-
Method Summary
Modifier and Type Method Description final StringgetCHANNEL_ID()Default notification channel of the microphone foreground service (IMPORTANCE_MIN, as in 5.1.2). final NotificationChannelgetNotificationChannel()final UnitsetNotificationChannel(NotificationChannel notificationChannel)final AfpMatchergetMatcher()final UnitsetMatcher(AfpMatcher matcher)final SORIApiClientgetApi()final UnitsetApi(SORIApiClient api)IBinderonBind(Intent intent)UnitonCreate()IntegeronStartCommand(Intent intent, Integer flags, Integer startId)UnitonDestroy()UnitonTimeout(Integer startId, Integer fgsType)Called when the foreground service has reached its time limit on Android 15+. final UnitclearState()final UnitinitializeApiClient(String applicationId, String secretKey, String sessionId)final UnitupdateConfig(SORIConfig newConfig)Update the configuration for the service at once, as in 5.1.2. final LonggetRemainingServiceTime()Gets the remaining service runtime in milliseconds before the Android 15 time limit. final BooleanisApproachingTimeLimit()Checks if the service is approaching the Android 15 time limit. final UnitapplyPendingUpdates()-
Methods inherited from class android.app.Service
getApplication, getForegroundServiceType, onConfigurationChanged, onLowMemory, onRebind, onStart, onTaskRemoved, onTimeout, onTrimMemory, onUnbind, startForeground, startForeground, stopForeground, stopForeground, stopSelf, stopSelf, stopSelfResult -
Methods inherited from class android.content.ContextWrapper
bindIsolatedService, bindService, bindService, bindService, bindService, bindServiceAsUser, bindServiceAsUser, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingOrSelfUriPermissions, checkCallingPermission, checkCallingUriPermission, checkCallingUriPermissions, checkContentUriPermissionFull, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, checkUriPermissions, clearWallpaper, createAttributionContext, createConfigurationContext, createContext, createContextForSplit, createDeviceContext, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, createWindowContext, createWindowContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getAttributionSource, getAttributionTag, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDataDir, getDatabasePath, getDeviceId, getDir, getDisplay, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFileStreamPath, getFilesDir, getMainExecutor, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getOpPackageName, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getParams, getResources, getSharedPreferences, getSystemService, getSystemServiceName, getTheme, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, isUiContext, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerComponentCallbacks, registerDeviceIdChangeListener, registerReceiver, registerReceiver, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeSelfPermissionsOnKill, revokeUriPermission, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setTheme, setWallpaper, setWallpaper, startActivities, startActivities, startActivity, startActivity, startForegroundService, startInstrumentation, startIntentSender, startIntentSender, startService, stopService, unbindService, unregisterComponentCallbacks, unregisterDeviceIdChangeListener, unregisterReceiver, updateServiceGroup -
Methods inherited from class android.content.Context
bindIsolatedService, getColor, getColorStateList, getDrawable, getString, getString, getSystemService, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, revokeSelfPermissionOnKill, sendBroadcastWithMultiplePermissions -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getCHANNEL_ID
final String getCHANNEL_ID()
Default notification channel of the microphone foreground service (IMPORTANCE_MIN, as in 5.1.2).
-
getNotificationChannel
final NotificationChannel getNotificationChannel()
-
setNotificationChannel
final Unit setNotificationChannel(NotificationChannel notificationChannel)
-
getMatcher
final AfpMatcher getMatcher()
-
setMatcher
final Unit setMatcher(AfpMatcher matcher)
-
getApi
final SORIApiClient getApi()
-
setApi
final Unit setApi(SORIApiClient api)
-
onBind
IBinder onBind(Intent intent)
-
onCreate
Unit onCreate()
-
onStartCommand
Integer onStartCommand(Intent intent, Integer flags, Integer startId)
-
onDestroy
Unit onDestroy()
-
onTimeout
Unit onTimeout(Integer startId, Integer fgsType)
Called when the foreground service has reached its time limit on Android 15+. The service must stop itself within this callback. This is only called by the system when:
The device is running Android 15+ (API 35+)
The app targets Android 15+ (API 35+)
The service has been running for 6 hours within a 24-hour period
-
clearState
@Synchronized() final Unit clearState()
-
initializeApiClient
@Synchronized() final Unit initializeApiClient(String applicationId, String secretKey, String sessionId)
-
updateConfig
final Unit updateConfig(SORIConfig newConfig)
Update the configuration for the service at once, as in 5.1.2. It is applied on the main thread, which owns the configuration, the server query machine and channel state; a caller on another thread waits for it at most MAIN_THREAD_HANDOFF_TIMEOUT_MS and the change is applied in order even when that wait ends first. Never throws. SORIAudioRecognizer.setConfig goes through requestConfig instead, which holds a server-part change of an active session until its next start or resume.
-
getRemainingServiceTime
final Long getRemainingServiceTime()
Gets the remaining service runtime in milliseconds before the Android 15 time limit. Returns -1 if there's no time limit (app doesn't target Android 15+) or if the service is not running.
-
isApproachingTimeLimit
final Boolean isApproachingTimeLimit()
Checks if the service is approaching the Android 15 time limit. Returns true if less than 5 minutes remain before the time limit. Returns false for apps that don't target Android 15+.
-
applyPendingUpdates
final Unit applyPendingUpdates()
-
-
-
-