Class SORIAudioRecognitionService

  • All Implemented Interfaces:
    android.content.ComponentCallbacks , android.content.ComponentCallbacks2

    
    public class SORIAudioRecognitionService
    extends Service
                        

    Foreground service that handles audio recognition tasks.

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final String getCHANNEL_ID() Default notification channel of the microphone foreground service (IMPORTANCE_MIN, as in 5.1.2).
      final NotificationChannel getNotificationChannel()
      final Unit setNotificationChannel(NotificationChannel notificationChannel)
      final AfpMatcher getMatcher()
      final Unit setMatcher(AfpMatcher matcher)
      final SORIApiClient getApi()
      final Unit setApi(SORIApiClient api)
      IBinder onBind(Intent intent)
      Unit onCreate()
      Integer onStartCommand(Intent intent, Integer flags, Integer startId)
      Unit onDestroy()
      Unit onTimeout(Integer startId, Integer fgsType) Called when the foreground service has reached its time limit on Android 15+.
      final Unit clearState()
      final Unit initializeApiClient(String applicationId, String secretKey, String sessionId)
      final Unit updateConfig(SORIConfig newConfig) Update the configuration for the service at once, as in 5.1.2.
      final Long getRemainingServiceTime() Gets the remaining service runtime in milliseconds before the Android 15 time limit.
      final Boolean isApproachingTimeLimit() Checks if the service is approaching the Android 15 time limit.
      final Unit applyPendingUpdates()
      • 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
    • Constructor Detail

      • SORIAudioRecognitionService

        SORIAudioRecognitionService()
    • Method Detail

      • getCHANNEL_ID

         final String getCHANNEL_ID()

        Default notification channel of the microphone foreground service (IMPORTANCE_MIN, as in 5.1.2).

      • onBind

         IBinder onBind(Intent intent)
      • onStartCommand

         Integer onStartCommand(Intent intent, Integer flags, Integer startId)
      • 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+.