About Restore Credentials

Credential Manager's Restore Credentials feature lets users automatically restore their app accounts and sign in during device setup or upon first opening an app on a new device. A restore credential, also known as a restore key, is a credential stored locally on the device and optionally backed up to the cloud, and then used to silently provision access on the user's new device.

Restore keys are system-managed exclusively by Google Play services for silent session restoration. Unlike user-created passkeys, restore keys don't sync to or appear in Google Password Manager or third-party credential providers.

This guide assumes you're familiar with the following concepts:

Benefits

The benefits of Restore Credentials include:

  • Seamless user experience: Users can begin using your app immediately on their new device without manually signing in.
  • Increased user retention and reduced support costs: Automatic sign-in during device upgrades prevents user drop-off and lowers support costs associated with abandoned accounts and password recovery flows.
  • Enhanced security: Silent credential restoration eliminates extra sign-in screens and manual account recovery prompts, reducing exposure to phishing and credential theft attacks.
  • Immediate engagement: You can re-engage users with push notifications as soon as they finish setting up their new device, even before they open your app for the first time.
  • Compatibility across authentication methods: Restore Credentials works alongside your app's existing primary authentication methods without requiring UI changes to your sign-in screen, including:

Process overview

The following sections describe how Restore Credentials operates on the previous device and the new device.

On the previous device

Generate the restore key after the user authenticates to your app, immediately after they sign in or register, and during a subsequent app launch if they're already signed in.

Google Play services stores the generated restore key in a dedicated encrypted credential store on the device, independent of standard Android Auto Backup (fullBackupContent or dataExtractionRules) and key-value backup streams, and syncs it to the cloud when cloud backup is enabled (isCloudBackupEnabled = true).

To back up a restore key to the cloud with end-to-end encryption, the device must:

  • Be signed in to an active backup Google Account.
  • Have Android data backup turned on with encrypted backup enrollment completed.
  • Have a knowledge-factor screen lock (PIN, pattern, or password).

If these conditions aren't met, calling createCredential with isCloudBackupEnabled = true throws E2eeUnavailableException. In this case, your app falls back to isCloudBackupEnabled = false so direct device-to-device transfer remains available.

On the new device

When the user sets up their new device, Android transfers the restore key silently during device setup through either of the following paths:

  • From a cloud backup: When cloud backup was enabled during key creation (isCloudBackupEnabled = true), the end-to-end encrypted restore key downloads to the new device during device setup after the user verifies their previous device's PIN, pattern, or password.
  • Using a device-to-device (D2D) transfer: When the user transfers data directly between devices during setup over a USB cable or encrypted Wi-Fi Direct, the restore key transfers directly after Google Account setup, even if cloud backup or app-data D2D restore isn't used.

After the restore key arrives on the new device, your app retrieves it to silently sign in the user using background restoration with a foreground fallback: automatically in the background during device setup using BackupAgent.onRestoreFinished (recommended, requires android:allowBackup="true"), with a fallback on first app launch in your launcher Activity.onCreate.

The flow to restore credentials from an old device to a new device requires no user interaction
Figure 1: Process overview to restore credentials

Security and key protection

Restore Credentials enforces cryptographic isolation and user-presence protections across local storage, cloud backup, and direct device transfers:

  • App package and signing-certificate binding: Google Play services binds every restore key to both your app's package name and its developer signing-certificate SHA-256 digest. Other apps or repackaged APKs with a different signing certificate can't read, overwrite, or clear your app's restore key.
  • On-device encryption at rest: Because restore keys migrate across devices during upgrades, the ECDSA P-256 private key isn't marked hardware non-exportable. Instead, Google Play services encrypts the key payload at rest using authenticated encryption (AES-GCM) wrapped by a hardware-backed AndroidKeyStore wrapping key inside Play services' isolated storage. Client apps never access raw private key material and receive only signed WebAuthn assertions (AuthenticatorAssertionResponse). Removing the device screen lock later leaves local storage protected by AndroidKeyStore and Android UID isolation, while pausing end-to-end encrypted cloud sync until a knowledge-factor screen lock is re-enabled.
  • End-to-end encrypted cloud backup: When isCloudBackupEnabled is true, the user's lock screen knowledge factor (PIN, pattern, or password) serves as the cryptographic root of trust, protected by hardware security modules (HSMs) in Google Cloud Key Vault with hardware-enforced brute-force rate limiting. Google Play services encrypts the restore key locally with AES-GCM before upload so Google servers store only ciphertext. Recovering the key from cloud backup during new-device setup requires entering the previous device's PIN, pattern, or password.
  • Device-to-device (D2D) transfer security: Direct D2D transfer protects against unauthorized copying by requiring physical proximity of both devices, an actively unlocked source device, explicit mutual pairing consent during setup (such as verification code confirmation or USB authorization), a locally encrypted peer-to-peer channel (USB cable or encrypted Wi-Fi Direct), and fresh WebAuthn SHA256withECDSA challenge-response signing verified by your server on the new device.

Pair Restore Credentials with app data backup

In addition to signing the user back in, we recommend setting android:allowBackup="true" in AndroidManifest.xml (if set to "false") and pairing Restore Credentials with Android Auto Backup so both sign-in state and local user data transfer seamlessly:

  • Restore identity in the background: Enabling android:allowBackup="true" lets your app retrieve the restore key inside BackupAgent.onRestoreFinished during device setup so push notifications and background sync resume before the user opens your app.
  • Restore state and preferences: Configure Auto Backup (dataExtractionRules) to preserve user preferences, local databases, and non-credential app state across cloud and cable device transfers, and test your app data restore behavior alongside credential restoration. Exclude raw authentication tokens and hardware-bound AndroidKeyStore ciphertext in data_extraction_rules.xml, and store your local has_synced_restore_credential marker in Context.getNoBackupFilesDir() so Android excludes it from backup automatically.

Handle multiple devices, system profiles, and app accounts

Account for the following behaviors across multidevice households, multi-account apps, and Android system profiles.

Multiple devices sharing a Google Account

Cloud backups maintain separate per-device backup datasets under a user's Google Account. If a user signs in across multiple devices (such as a phone and a tablet) that share the same Google Account, each device backs up its own restore key independently without overwriting the other, even if the devices are signed in to different in-app accounts. When setting up an additional device, Android restores the key from whichever source device backup the user selects during setup.

Apps with multiple signed-in accounts

Some apps let users switch between multiple active accounts on a single device (for example, a personal and a work account within the same app). Restore Credentials supports one restore key per app package on a single device. If a user is signed in to multiple accounts simultaneously, create the restore key for the primary or most recently active account.

Devices with multiple system profiles

On devices configured with separate Android system profiles (such as a device with a personal profile and a managed work profile), the restore key is available only to the profile that was set up first on the device. If an enterprise IT policy disables cross-device backup or credential transfer inside a managed work profile, createCredential or getCredential might return no credential and your app should fall back to standard sign-in.

Limitations

Restore Credentials is supported on Android phones, foldables, and tablets running Android 9 (API level 28) or higher with Google Play services version 242200000 or higher. Cross-device-category restoration (such as restoring from a phone to Wear OS, Android TV, Android Auto, Android XR, or ChromeOS) isn't supported; see Authenticate across form factors.

Next steps