abstract class DeviceSetupService : Service


This service builds upon the functionality of CredentialProviderService by enabling support for more advanced credential requests, such as device setup.

Note that this service is distinct from CredentialProviderService, which handles basic credential saving and retrieval requests. This service is mainly used to help with user pain point of credentials onboarding during device setup. When the user is setting up a new device, the credential provider can assist with the onboarding by either transferring the credentials to the new device, or receiving the credentials if the current device is the one doing the onboarding.

This service is bound only during the duration of an API call. To receive requests, users must enable the corresponding CredentialProviderService from within the same package, in Android Settings. This service will be invoked as part of Android onboarding and will not contain any UI as part of the process.

Basic Usage

The interaction between Credential Manager and this service typically involves:

  • The Android system forwards the request to enabled credential providers that support the requested feature.

  • Credential providers receive the request, process it, and return an appropriate response.

  • The Android system sends the result back to the client application.

This flow is designed to minimize the service's lifecycle. Calls to the service are stateless. If a service requires maintaining states between calls, it must implement its own state management. Note that the service's process may be terminated by the Android System when unbound, such as during low-memory conditions.

Service Registration

To enable Credential Manager to send requests to a provider service, the provider must:

  • Extend this class and implement the required methods.

  • Declare this service class within Android Manifest with corresponding intent action "androidx.credentials.DEVICE_SETUP_SERVICE_ACTION".

Summary

Public constructors

Public functions

final IBinder?
onBind(intent: Intent?)
abstract Unit

Called when a credential provider should receive credentials for device setup.

abstract Unit

Called when a credential provider should return the state of its credentials to the user.

abstract Unit

Called when a credential provider should return credentials for device setup.

Inherited functions

From android.content.Context
From android.content.ContextWrapper
open Boolean
bindIsolatedService(
    p0: Intent,
    p1: Int,
    p2: String,
    p3: Executor,
    p4: ServiceConnection
)
open Boolean
bindService(
    p0: Intent,
    p1: ServiceConnection,
    p2: Context.BindServiceFlags
)
open Boolean
open Boolean
bindService(
    p0: Intent,
    p1: Context.BindServiceFlags,
    p2: Executor,
    p3: ServiceConnection
)
open Boolean
bindService(p0: Intent, p1: Int, p2: Executor, p3: ServiceConnection)
open Boolean
bindServiceAsUser(
    p0: Intent,
    p1: ServiceConnection,
    p2: Context.BindServiceFlags,
    p3: UserHandle
)
open Boolean
open Int
open Int
open IntArray
open Int
open Int
open IntArray
open Int
checkContentUriPermissionFull(p0: Uri, p1: Int, p2: Int, p3: Int)
open Int
checkPermission(p0: String, p1: Int, p2: Int)
open Int
open Int
checkUriPermission(p0: Uri, p1: Int, p2: Int, p3: Int)
open Int
checkUriPermission(p0: Uri?, p1: String?, p2: String?, p3: Int, p4: Int, p5: Int)
open IntArray
checkUriPermissions(p0: MutableList<Uri>, p1: Int, p2: Int, p3: Int)
open Unit

This function is deprecated. Deprecated in Java

open Context
open Context
open Context
open Context
open Context
open Context
open Context
open Context
open Context
open Context
createWindowContext(p0: Display, p1: Int, p2: Bundle?)
open Array<String>
open Boolean
open Boolean
open Boolean
open Unit
open Unit
open Unit
open Unit
open Unit
enforcePermission(p0: String, p1: Int, p2: Int, p3: String?)
open Unit
enforceUriPermission(p0: Uri, p1: Int, p2: Int, p3: Int, p4: String)
open Unit
enforceUriPermission(
    p0: Uri?,
    p1: String?,
    p2: String?,
    p3: Int,
    p4: Int,
    p5: Int,
    p6: String?
)
open Array<String>
open Context
open ApplicationInfo
open AssetManager
open AttributionSource
open String?
open Context
open File
open ClassLoader
open File
open ContentResolver
open File
open File
open Int
open File
getDir(p0: String, p1: Int)
open Display?
open File?
open Array<File>
open File?
open Array<File>
open Array<File>
open File
open File
open Executor
open Looper
open File
open File
open Array<File>
open String
open String
open PackageManager
open String
open String
open ContextParams?
open Resources
open SharedPreferences
open Any
open String?
open Resources.Theme
open Drawable

This function is deprecated. Deprecated in Java

open Int

This function is deprecated. Deprecated in Java

open Int

This function is deprecated. Deprecated in Java

open Unit
grantUriPermission(p0: String, p1: Uri, p2: Int)
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open FileInputStream
open FileOutputStream
open SQLiteDatabase
open SQLiteDatabase
openOrCreateDatabase(
    p0: String,
    p1: Int,
    p2: SQLiteDatabase.CursorFactory,
    p3: DatabaseErrorHandler?
)
open Drawable

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Intent?
open Intent?
open Intent?
registerReceiver(
    p0: BroadcastReceiver?,
    p1: IntentFilter,
    p2: String?,
    p3: Handler?
)
open Intent?
registerReceiver(
    p0: BroadcastReceiver?,
    p1: IntentFilter,
    p2: String?,
    p3: Handler?,
    p4: Int
)
open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
revokeUriPermission(p0: String, p1: Uri, p2: Int)
open Unit
open Unit
open Unit
sendBroadcast(p0: Intent, p1: String?, p2: Bundle?)
open Unit
open Unit
open Unit
open Unit
open Unit
sendOrderedBroadcast(
    p0: Intent,
    p1: String?,
    p2: BroadcastReceiver?,
    p3: Handler?,
    p4: Int,
    p5: String?,
    p6: Bundle?
)
open Unit
sendOrderedBroadcast(
    p0: Intent,
    p1: String?,
    p2: Bundle?,
    p3: BroadcastReceiver?,
    p4: Handler?,
    p5: Int,
    p6: String?,
    p7: Bundle?
)
open Unit
sendOrderedBroadcast(
    p0: Intent,
    p1: String?,
    p2: String?,
    p3: BroadcastReceiver?,
    p4: Handler?,
    p5: Int,
    p6: String?,
    p7: Bundle?
)
open Unit
sendOrderedBroadcast(
    p0: Intent,
    p1: Int,
    p2: String?,
    p3: String?,
    p4: BroadcastReceiver?,
    p5: Handler?,
    p6: String?,
    p7: Bundle?,
    p8: Bundle?
)
open Unit
sendOrderedBroadcastAsUser(
    p0: Intent,
    p1: UserHandle,
    p2: String?,
    p3: BroadcastReceiver?,
    p4: Handler?,
    p5: Int,
    p6: String?,
    p7: Bundle?
)
open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit
sendStickyOrderedBroadcast(
    p0: Intent,
    p1: BroadcastReceiver?,
    p2: Handler?,
    p3: Int,
    p4: String?,
    p5: Bundle?
)

This function is deprecated. Deprecated in Java

open Unit
sendStickyOrderedBroadcastAsUser(
    p0: Intent,
    p1: UserHandle,
    p2: BroadcastReceiver?,
    p3: Handler?,
    p4: Int,
    p5: String?,
    p6: Bundle?
)

This function is deprecated. Deprecated in Java

open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
open Unit
open ComponentName?
open Boolean
open Unit
startIntentSender(p0: IntentSender, p1: Intent?, p2: Int, p3: Int, p4: Int)
open Unit
startIntentSender(
    p0: IntentSender,
    p1: Intent?,
    p2: Int,
    p3: Int,
    p4: Int,
    p5: Bundle?
)
open ComponentName?
open Boolean
open Unit
open Unit
open Unit
open Unit
open Unit
From android.app.Service
open Unit
open Unit
Application
Int
open Unit
open Unit
open Unit
open Unit

This function is deprecated.

open Unit
open Unit
onStart(p0: Intent, p1: Int)

This function is deprecated. Deprecated in Java

open Int
onStartCommand(p0: Intent, p1: Int, p2: Int)
open Unit
open Unit
open Unit
onTimeout(p0: Int, p1: Int)
open Unit
open Boolean
Unit
Unit
startForeground(p0: Int, p1: Notification, p2: Int)
Unit

This function is deprecated. Deprecated in Java

Unit
Unit
Unit
Boolean

Public constructors

DeviceSetupService

Added in 1.0.0-alpha02
DeviceSetupService()

Public functions

onBind

Added in 1.0.0-alpha02
final fun onBind(intent: Intent?): IBinder?

onExportCredentialsRequest

Added in 1.0.0-alpha02
abstract fun onExportCredentialsRequest(
    request: ExportCredentialsRequest,
    callingAppInfo: CallingAppInfo,
    callback: OutcomeReceiverCompat<ExportCredentialsResponseExportCredentialsException>
): Unit

Called when a credential provider should receive credentials for device setup.

This method should be extended by credential providers to receive credential push requests. When the current device is being setup with a paired device, the credentials from the paired device can be transferred to the current device.

Parameters
request: ExportCredentialsRequest

The request for pushing the credentials to this device.

callingAppInfo: CallingAppInfo

the requesting app info

callback: OutcomeReceiverCompat<ExportCredentialsResponseExportCredentialsException>

The callback to receive the result of the credential push.

onGetCredentialTransferCapabilities

Added in 1.0.0-alpha02
abstract fun onGetCredentialTransferCapabilities(
    request: CredentialTransferCapabilitiesRequest,
    callingAppInfo: CallingAppInfo,
    callback: OutcomeReceiverCompat<CredentialTransferCapabilitiesGetCredentialTransferCapabilitiesException>
): Unit

Called when a credential provider should return the state of its credentials to the user.

This method should be extended by credential providers to facilitate with device setup. When the current device is used to facilitate the device setup of another device, the Android System can request for the number of credentials that can be transferred and their size. These info can be displayed to the user during the setup process.

Parameters
request: CredentialTransferCapabilitiesRequest

The request for the state of the transferable credentials to this device.

callingAppInfo: CallingAppInfo

the requesting app info

callback: OutcomeReceiverCompat<CredentialTransferCapabilitiesGetCredentialTransferCapabilitiesException>

The callback to receive the result of the request.

onImportCredentialsRequest

Added in 1.0.0-alpha02
abstract fun onImportCredentialsRequest(
    request: ImportCredentialsRequest,
    callingAppInfo: CallingAppInfo,
    callback: OutcomeReceiverCompat<ImportCredentialsResponseImportCredentialsException>
): Unit

Called when a credential provider should return credentials for device setup.

This method should be extended by credential providers to receive credential fetch requests. When the current device is used to facilitate the device setup of another device, the Android System can request for the credentials stored on this device to be transferred to the new device.

Parameters
request: ImportCredentialsRequest

The request for pulling the credentials from this device.

callingAppInfo: CallingAppInfo

the requesting app info

callback: OutcomeReceiverCompat<ImportCredentialsResponseImportCredentialsException>

The callback to receive the result of the credential fetching.