BaseSoundscapeAppFunctionService

Exposes Soundscape's actions to Gemini and other agents.

Every function is a thin wrapper over SoundscapeActionExecutor, the same shared vocabulary the iOS App Intents run on, so the two platforms cannot drift into describing different capabilities.

The KDoc on each function below is not decoration: with isDescribedByKDoc = true it becomes the natural-language description the agent reads to decide when to call it, and the agent sees each one on its own. So each says for itself whether Soundscape must be open and whether the answer is spoken by the app, even where that repeats. The app-wide context (who the app is for, how it answers) is in res/xml/app_functions_app_metadata.xml.

Requires API 36, well above the app's minSdk of 30. Nothing else references this class, so on older devices the service simply never starts.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val assets: AssetManager?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val baseContext: Context?
Link copied to clipboard
open val cacheDir: File?
Link copied to clipboard
Link copied to clipboard
open val codeCacheDir: File?
Link copied to clipboard
Link copied to clipboard
open val dataDir: File?
Link copied to clipboard
open val deviceId: Int
Link copied to clipboard
open val display: Display?
Link copied to clipboard
Link copied to clipboard
open val externalCacheDirs: Array<out File?>?
Link copied to clipboard
open val externalMediaDirs: Array<out File?>?
Link copied to clipboard
open val filesDir: File?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val mainLooper: Looper?
Link copied to clipboard
Link copied to clipboard
open val obbDir: File?
Link copied to clipboard
open val obbDirs: Array<out File?>?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val packageName: String?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val resources: Resources?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val wallpaper: Drawable?

Functions

Link copied to clipboard

Answers "what's ahead of me?": Soundscape calls out the roads, junctions and places lying ahead in the direction the user is facing or walking.

Link copied to clipboard
suspend fun aroundMe(): SoundscapeResult

Answers "what's around me?": Soundscape calls out points of interest on every side of the user, each positioned in spatial audio so it sounds from its real direction. For the street the user is on, use myLocation; for only what is in front, aheadOfMe.

Link copied to clipboard

Answers "what is the beacon on?" or "where is my beacon?": Soundscape says the beacon's name, distance, direction and street address. For just the distance, use calloutBeacon.

Link copied to clipboard
open fun bindIsolatedService(service: Intent, flags: Context.BindServiceFlags, instanceName: String, executor: Executor, conn: ServiceConnection): Boolean
open fun bindIsolatedService(service: Intent, flags: Int, instanceName: String, executor: Executor, conn: ServiceConnection): Boolean
Link copied to clipboard
open fun bindService(service: Intent, conn: ServiceConnection, flags: Int): Boolean
open fun bindService(service: Intent, flags: Context.BindServiceFlags, executor: Executor, conn: ServiceConnection): Boolean
open fun bindService(service: Intent, flags: Int, executor: Executor, conn: ServiceConnection): Boolean
Link copied to clipboard
open fun bindServiceAsUser(service: Intent, conn: ServiceConnection, flags: Int, user: UserHandle): Boolean
Link copied to clipboard

A quick "how far is it?" for the audio beacon: Soundscape says the distance, heard from the beacon's direction. For the beacon's name and address as well, use beaconInfo.

Link copied to clipboard
open fun checkCallingOrSelfPermission(permission: String): Int
Link copied to clipboard
open fun checkCallingOrSelfUriPermission(uri: Uri?, modeFlags: Int): Int
Link copied to clipboard
open fun checkCallingOrSelfUriPermissions(uris: List<Uri?>, modeFlags: Int): IntArray
Link copied to clipboard
open fun checkCallingPermission(permission: String): Int
Link copied to clipboard
open fun checkCallingUriPermission(uri: Uri?, modeFlags: Int): Int
Link copied to clipboard
open fun checkCallingUriPermissions(uris: List<Uri?>, modeFlags: Int): IntArray
Link copied to clipboard
open fun checkContentUriPermissionFull(uri: Uri, pid: Int, uid: Int, modeFlags: Int): Int
Link copied to clipboard
open fun checkPermission(permission: String, pid: Int, uid: Int): Int
Link copied to clipboard
open fun checkSelfPermission(permission: String): Int
Link copied to clipboard
open fun checkUriPermission(uri: Uri?, pid: Int, uid: Int, modeFlags: Int): Int
open fun checkUriPermission(uri: Uri?, readPermission: String?, writePermission: String?, pid: Int, uid: Int, modeFlags: Int): Int
Link copied to clipboard
open fun checkUriPermissions(uris: List<Uri?>, pid: Int, uid: Int, modeFlags: Int): IntArray
Link copied to clipboard
open fun clearWallpaper()
Link copied to clipboard
open fun createAttributionContext(attributionTag: String?): Context
Link copied to clipboard
open fun createConfigurationContext(overrideConfiguration: Configuration): Context?
Link copied to clipboard
open fun createContext(contextParams: ContextParams): Context
Link copied to clipboard
open fun createContextForSplit(splitName: String?): Context?
Link copied to clipboard
open fun createDeviceContext(deviceId: Int): Context
Link copied to clipboard
open fun createDisplayContext(display: Display): Context?
Link copied to clipboard
open fun createPackageContext(packageName: String?, flags: Int): Context?
Link copied to clipboard
open fun createWindowContext(type: Int, options: Bundle?): Context
open fun createWindowContext(display: Display, type: Int, options: Bundle?): Context
Link copied to clipboard
open fun databaseList(): Array<out String?>?
Link copied to clipboard
open fun deleteDatabase(name: String?): Boolean
Link copied to clipboard
open fun deleteFile(name: String?): Boolean
Link copied to clipboard
Link copied to clipboard
open fun enforceCallingOrSelfPermission(permission: String, message: String?)
Link copied to clipboard
open fun enforceCallingOrSelfUriPermission(uri: Uri?, modeFlags: Int, message: String?)
Link copied to clipboard
open fun enforceCallingPermission(permission: String, message: String?)
Link copied to clipboard
open fun enforceCallingUriPermission(uri: Uri?, modeFlags: Int, message: String?)
Link copied to clipboard
open fun enforcePermission(permission: String, pid: Int, uid: Int, message: String?)
Link copied to clipboard
open fun enforceUriPermission(uri: Uri?, pid: Int, uid: Int, modeFlags: Int, message: String?)
open fun enforceUriPermission(uri: Uri?, readPermission: String?, writePermission: String?, pid: Int, uid: Int, modeFlags: Int, message: String?)
Link copied to clipboard
open fun fileList(): Array<out String?>?
Link copied to clipboard
fun getColor(id: Int): Int
Link copied to clipboard
Link copied to clipboard
open fun getDatabasePath(name: String?): File?
Link copied to clipboard
open fun getDir(name: String?, mode: Int): File?
Link copied to clipboard
Link copied to clipboard
open fun getExternalFilesDir(type: String?): File?
Link copied to clipboard
open fun getExternalFilesDirs(type: String?): Array<out File?>?
Link copied to clipboard
open fun getFileStreamPath(name: String?): File?
Link copied to clipboard
Link copied to clipboard
fun getString(resId: Int): String
fun getString(resId: Int, vararg formatArgs: Any?): String
Link copied to clipboard
fun <T : Any?> getSystemService(serviceClass: Class<T?>): T?
open fun getSystemService(name: String): Any?
Link copied to clipboard
open fun getSystemServiceName(serviceClass: Class<*>): String?
Link copied to clipboard
fun getText(resId: Int): CharSequence
Link copied to clipboard
open fun grantUriPermission(toPackage: String?, uri: Uri?, modeFlags: Int)
Link copied to clipboard

Lists the names of the places the user has saved as markers in Soundscape, for choosing one to pass to startBeacon. Works whether or not Soundscape is open, because it only reads saved data. Read the message to the user, or use it to pick the marker they meant.

Link copied to clipboard

Lists the names of the routes the user has saved in Soundscape, for choosing one to pass to startRoute. Works whether or not Soundscape is open, because it only reads saved data. Read the message to the user, or use it to pick the route they meant.

Link copied to clipboard
open fun moveDatabaseFrom(sourceContext: Context?, name: String?): Boolean
Link copied to clipboard
open fun moveSharedPreferencesFrom(sourceContext: Context?, name: String?): Boolean
Link copied to clipboard

Answers "where am I?": Soundscape says the street the user is on or the junction they are at, and the nearest landmarks. For points of interest all around, use aroundMe; for what is in front, aheadOfMe.

Link copied to clipboard

Calls out the user's own saved markers (places they saved in Soundscape) that are close by, each from its direction. To hear all saved markers by name wherever they are, use listMarkers.

Link copied to clipboard

Skips forward to the next waypoint on the route that is playing, moving the beacon there.

Link copied to clipboard
Link copied to clipboard
fun onBind(intent: Intent?): IBinder
Link copied to clipboard
Link copied to clipboard
open override fun onCreate()
Link copied to clipboard
open override fun onDestroy()
Link copied to clipboard
Link copied to clipboard
open fun onLowMemory()
Link copied to clipboard
open fun onRebind(intent: Intent?)
Link copied to clipboard
open fun onStart(intent: Intent?, startId: Int)
Link copied to clipboard
open fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int
Link copied to clipboard
open fun onTaskRemoved(rootIntent: Intent?)
Link copied to clipboard
open fun onTimeout(startId: Int)
open fun onTimeout(startId: Int, fgsType: Int)
Link copied to clipboard
open fun onTrimMemory(level: Int)
Link copied to clipboard
open fun onUnbind(intent: Intent?): Boolean
Link copied to clipboard
Link copied to clipboard
open fun openFileOutput(name: String?, mode: Int): FileOutputStream?
Link copied to clipboard
Link copied to clipboard
open fun peekWallpaper(): Drawable?
Link copied to clipboard

Goes back to the previous waypoint on the route that is playing, moving the beacon there.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun registerDeviceIdChangeListener(executor: Executor, listener: IntConsumer)
Link copied to clipboard
open fun registerReceiver(receiver: BroadcastReceiver?, filter: IntentFilter?): Intent?
open fun registerReceiver(receiver: BroadcastReceiver?, filter: IntentFilter?, flags: Int): Intent?
open fun registerReceiver(receiver: BroadcastReceiver?, filter: IntentFilter?, broadcastPermission: String?, scheduler: Handler?): Intent?
open fun registerReceiver(receiver: BroadcastReceiver?, filter: IntentFilter?, broadcastPermission: String?, scheduler: Handler?, flags: Int): Intent?
Link copied to clipboard
open fun removeStickyBroadcast(intent: Intent?)
Link copied to clipboard
open fun removeStickyBroadcastAsUser(intent: Intent?, user: UserHandle?)
Link copied to clipboard
open fun resolveInventory(): AppFunctionInventory?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun revokeUriPermission(uri: Uri?, modeFlags: Int)
open fun revokeUriPermission(targetPackage: String?, uri: Uri?, modeFlags: Int)
Link copied to clipboard
open fun sendBroadcast(intent: Intent?)
open fun sendBroadcast(intent: Intent?, receiverPermission: String?)
open fun sendBroadcast(intent: Intent, receiverPermission: String?, options: Bundle?)
Link copied to clipboard
open fun sendBroadcastAsUser(intent: Intent?, user: UserHandle?)
open fun sendBroadcastAsUser(intent: Intent?, user: UserHandle?, receiverPermission: String?)
Link copied to clipboard
open fun sendBroadcastWithMultiplePermissions(intent: Intent, receiverPermissions: Array<out String?>)
Link copied to clipboard
open fun sendOrderedBroadcast(intent: Intent?, receiverPermission: String?)
open fun sendOrderedBroadcast(intent: Intent, receiverPermission: String?, options: Bundle?)
open fun sendOrderedBroadcast(intent: Intent, receiverPermission: String?, resultReceiver: BroadcastReceiver?, scheduler: Handler?, initialCode: Int, initialData: String?, initialExtras: Bundle?)
open fun sendOrderedBroadcast(intent: Intent, receiverPermission: String?, options: Bundle?, resultReceiver: BroadcastReceiver?, scheduler: Handler?, initialCode: Int, initialData: String?, initialExtras: Bundle?)
open fun sendOrderedBroadcast(intent: Intent, receiverPermission: String?, receiverAppOp: String?, resultReceiver: BroadcastReceiver?, scheduler: Handler?, initialCode: Int, initialData: String?, initialExtras: Bundle?)
open fun sendOrderedBroadcast(intent: Intent, initialCode: Int, receiverPermission: String?, receiverAppOp: String?, resultReceiver: BroadcastReceiver?, scheduler: Handler?, initialData: String?, initialExtras: Bundle?, options: Bundle?)
Link copied to clipboard
open fun sendOrderedBroadcastAsUser(intent: Intent?, user: UserHandle?, receiverPermission: String?, resultReceiver: BroadcastReceiver?, scheduler: Handler?, initialCode: Int, initialData: String?, initialExtras: Bundle?)
Link copied to clipboard
open fun sendStickyBroadcast(intent: Intent?)
open fun sendStickyBroadcast(intent: Intent, options: Bundle?)
Link copied to clipboard
open fun sendStickyBroadcastAsUser(intent: Intent?, user: UserHandle?)
Link copied to clipboard
open fun sendStickyOrderedBroadcast(intent: Intent?, resultReceiver: BroadcastReceiver?, scheduler: Handler?, initialCode: Int, initialData: String?, initialExtras: Bundle?)
Link copied to clipboard
open fun sendStickyOrderedBroadcastAsUser(intent: Intent?, user: UserHandle?, resultReceiver: BroadcastReceiver?, scheduler: Handler?, initialCode: Int, initialData: String?, initialExtras: Bundle?)
Link copied to clipboard

Silences or restores the audio beacon's repeating tone, without stopping the beacon or route: it keeps its place and can be unmuted later. Asking for the state it is already in changes nothing. To remove the beacon altogether, use stopBeacon or stopRoute.

Link copied to clipboard

Sets how much Soundscape says automatically as the user walks: Silent turns automatic callouts off altogether, leaving beacons, routes and on-demand callouts; Essential calls out only streets, junctions and landmarks; Simplified skips minor paths and repeats itself less; Detailed calls out everything nearby. Useful when a busy street is too noisy, or a quiet one too sparse. The change is saved, the same as choosing it in Settings.

Link copied to clipboard
open fun setTheme(resid: Int)
Link copied to clipboard
open fun setWallpaper(bitmap: Bitmap?)
open fun setWallpaper(data: InputStream?)
Link copied to clipboard
open fun startActivities(intents: Array<out Intent?>?)
open fun startActivities(intents: Array<out Intent?>?, options: Bundle?)
Link copied to clipboard
open fun startActivity(intent: Intent?)
open fun startActivity(intent: Intent?, options: Bundle?)
Link copied to clipboard
suspend fun startBeacon(name: String): SoundscapeResult

Sets an audio beacon on one of the user's saved markers: a repeating tone that sounds from the marker's direction, so the user can walk towards it, until it is stopped. Only places the user has already saved as markers in Soundscape can be used; it cannot search for a shop, address or other new place. If unsure of the name, call listMarkers first.

Link copied to clipboard
fun startForeground(id: Int, notification: Notification?)
fun startForeground(id: Int, notification: Notification, foregroundServiceType: Int)
Link copied to clipboard
Link copied to clipboard
open fun startInstrumentation(className: ComponentName, profileFile: String?, arguments: Bundle?): Boolean
Link copied to clipboard
open fun startIntentSender(intent: IntentSender?, fillInIntent: Intent?, flagsMask: Int, flagsValues: Int, extraFlags: Int)
open fun startIntentSender(intent: IntentSender?, fillInIntent: Intent?, flagsMask: Int, flagsValues: Int, extraFlags: Int, options: Bundle?)
Link copied to clipboard
suspend fun startRoute(name: String): SoundscapeResult

Starts playing one of the user's saved routes: an audio beacon guides them to each waypoint in turn. Only routes the user has already saved in Soundscape can be started; it cannot plan a route to a new place. If unsure of the name, call listRoutes first.

Link copied to clipboard
open fun startService(service: Intent?): ComponentName?
Link copied to clipboard

Switches the audio beacon off. To only silence it for a while, use setBeaconMuted. Read the message to the user: it confirms the beacon stopped. Soundscape must be open.

Link copied to clipboard
fun stopForeground(removeNotification: Boolean)
fun stopForeground(notificationBehavior: Int)
Link copied to clipboard

Stops the route that is playing, and its beacon. Read the message to the user: it confirms the route stopped. Soundscape must be open.

Link copied to clipboard
fun stopSelf()
fun stopSelf(startId: Int)
Link copied to clipboard
fun stopSelfResult(startId: Int): Boolean
Link copied to clipboard
open fun stopService(name: Intent?): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun updateServiceGroup(conn: ServiceConnection, group: Int, importance: Int)