restore-credentials

Implement Android Restore Credentials with androidx.credentials for silent sign-in on new devices.

7.1k|466|Updated Mar 16, 2026
One-click install
npx skills add https://github.com/android/skills --skill restore-credentials
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: restore-credentials
Source: https://github.com/android/skills/tree/main/identity/restore-credentials
Command: npx skills add https://github.com/android/skills --skill restore-credentials

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires androidx.credentials:credentials, androidx.credentials:credentials-play-services-auth, and includes references (resource) components.

What problem does it solve?

Users who restore their app on a new Android device normally have to sign in again manually. This Skill guides the implementation of Android's Restore Credentials feature so users are silently signed back in after a device restore, without changing existing authentication flows.

Core Features & Use Cases

  • Restore Key Lifecycle: Create, retrieve, and delete restore keys using the androidx.credentials Credential Manager API, including E2eeUnavailableException fallback handling.
  • Two-Tier Restoration: Implements background restoration via BackupAgent.onRestoreFinished() and a foreground fallback in the launcher Activity based on the app's allowBackup manifest setting.
  • Backend Handoff Checklist: Provides explicit server-side guidelines covering key differentiation from passkeys, orphaned key cleanup, TTL policies, and multi-device support.
  • Use Case: A messaging app wants users automatically logged in after restoring onto a new phone so notifications resume immediately; this Skill walks through the complete client-side integration.

Quick Start

Implement Android Restore Credentials in my app so users are silently signed in when they restore the app on a new device.

Frequently Asked Questions about restore-credentials

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement Android Restore Credentials with Credential Manager?▼

Create a restore key with CreateRestoreCredentialRequest when the user signs in, retrieve it with GetRestoreCredentialOption on a new device, and call clearCredentialState with TYPE_CLEAR_RESTORE_CREDENTIAL on sign-out. Use the androidx.credentials library version 1.5.0 or higher.

How do I sign users in automatically after an Android device restore?▼

Fetch the restore key in BackupAgent.onRestoreFinished() if allowBackup is true, and also in the launcher Activity's onCreate() as a foreground fallback. Send the retrieved public key to your server to authenticate the user silently.

Does Restore Credentials work if allowBackup is false?▼

Yes, Restore Credentials works regardless of the allowBackup manifest setting. If allowBackup is false, only implement the foreground restoration tier in the launcher Activity and do not implement a BackupAgent.

What Android versions support Restore Credentials?▼

Restore Credentials works on devices running Android 9 (API 28) and higher, with Google Play services core version 24220000 or higher, and androidx.credentials library version 1.5.0 or higher.

Why does createCredential throw E2eeUnavailableException?▼

E2eeUnavailableException occurs when isCloudBackupEnabled is true but the device lacks backup or end-to-end encryption such as a screen lock. Catch it and retry createCredential with isCloudBackupEnabled set to false.

Does Restore Credentials replace passkeys or passwords?▼

No, restore keys operate independently of your primary authentication method such as passwords, passkeys, or federated sign-in. They reuse the same server-side implementation as passkeys but require no changes to existing sign-in flows.