Skills

Restore Credentials

Provides knowledge and workflows to implement Android's Restore Credentials feature...

Install

npx skills add android/skills --skill restore-credentials -g -a claude-code -y
Repository
android/skills10.2k
Category
Mobile
Updated
6d ago
License
Complete terms in LICENSE.txt
Context cost
Mediumabout 3,000 tokens
Runs scripts
No, instructions only

What it does

Provides knowledge and workflows to implement Android's Restore Credentials feature using the androidx.credentials library. Use this skill to create, sign in with, and delete restore keys, enabling silent user sign-in on new devices after a restore. It covers version compatibility, dependencies, server-side prerequisites, and the complete client-side implementation for creating, retrieving, and clearing restore keys.

Fundamentals

The objective is to implement the Restore Credentials feature through the Android Credential Manager API (androidx.credentials). This allows apps that use or are integrating Credential Manager to silently log users back in when they restore their app on a new device. Restore Credentials operates independently of the app's primary authentication method (passwords, passkeys, federated sign-in) and requires no UI changes to existing sign-in flows.

Scope

Crucial: This skill focuses exclusively on the Android client-side integration. It does not implement the server-side cryptographic validation logic. The developer must be reminded of this and the Points to inform the developer about after implementation is done.

Implementation Guidelines

When instructed to implement Restore Credentials on a developer's application, remember the following:

  1. Before the implementation, you MUST read and understand the Two-Tier Restoration Architecture and review the DOs and DON'Ts.
  2. After the implementation, you MUST present the developer with the Backend Guidelines as a reminder for their backend setup. It is important that you remind the developer that they still have to implement the backend.

Two-Tier Restoration Architecture

To enable a resilient sign-in experience, retrieve credentials through a two-tier architecture:

  1. Tier 1 (Primary - Background): Executes automatically during device setup using the app's BackupAgent.onRestoreFinished() callback. This provides an invisible restoration before the user opens the app for the first time, allowing background sync and notification delivery.
  2. Tier 2 (Secondary - Foreground): Runs in the Launcher Activity.onCreate() to catch failovers if background restoration didn't complete (example: dropped network, delayed restoration) or if allowBackup is disabled.
Read the whole SKILL.md on GitHub

More in Mobile