restore-credentials
Fungsinya
Skill ini memandu sisi Android dari Restore Credentials, dengan memakai pustaka Credential Manager. Fitur ini memungkinkan pengguna yang kembali untuk masuk secara diam-diam setelah aplikasi dipulihkan di perangkat baru. Skill ditujukan bagi pengembang Android yang sudah memakai Credential Manager.
Kapan dipakai
- ✓Saat Anda ingin pengguna masuk kembali secara otomatis setelah memulihkan aplikasi Anda di ponsel baru.
- ✓Ketika Anda perlu membuat, memakai untuk masuk, atau menghapus kunci pemulihan di aplikasi Android Anda.
- ✓Ketika Anda perlu tahu apa yang harus dilakukan backend Anda agar restore credentials berfungsi.
Link skill
https://github.com/android/skills/blob/main/identity/restore-credentials/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
“Tambahkan Restore Credentials ke aplikasi Android saya agar pengguna bisa masuk kembali setelah dipulihkan ke ponsel baru.”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Skill menjelaskan desain pemulihan dua tingkat, lalu menambahkan kode untuk membuat, mengambil, dan menghapus kunci pemulihan di aplikasi. Skill diakhiri dengan daftar langkah backend yang harus Anda bangun.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
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:
- Before the implementation, you MUST read and understand the Two-Tier Restoration Architecture and review the DOs and DON'Ts.
- 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:
- 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. - 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 ifallowBackupis disabled.
If allowBackup in the manifest is set to true, implement both. Otherwise, only
implement tier 2 (Foreground Restoration). Do NOT change the value of
allowBackup in the manifest.
If you added a BackupAgent to the app, you MUST also set
android:fullBackupOnly="true" in the manifest. Do NOT do this if there
already existed a BackupAgent in the app before your implementation.
DOs and DON'Ts
DO:
- Do check
AndroidManifest.xmlfor the value of allowBackup to determine what you have to implement. - Do implement a fallback for createCredential: always try calling it first with
isCloudBackupEnabledset to true. If anE2eeUnavailableExceptionis thrown, catch it and retry the call withisCloudBackupEnabledset tofalse. - Do implement a
BackupAgent(subclass ofandroid.app.backup.BackupAgent) ifallowBackupis true in the manifest. - Do set
android:fullBackupOnly="true"in the manifest if you added aBackupAgentto the app. - Call
clearCredentialState()when the user signs out. This is a mandatory security measure to log the user out fully. - Do attempt to get the restore key on the first launch of the app on a new device and also within the
BackupAgent.onRestoreFinished()callback if your app uses it. - Do ensure that a restore credential is created even if the user is already logged in.
- Do ensure that the credential retrieval and login in
onRestoreFinished()is performed synchronously (for example usingrunBlocking). - Do restore notifications in the
BackupAgentif your app uses them. (For example capture and send FCM token to backend) - Do ensure that if you implement mock network requests or stubs, you replace all placeholders with valid, properly formatted JSON payloads for the credential requests.
- Do encapsulate credential creation and retrieval into their own dedicated functions. Because credential creation must be called in multiple places (sign-up, sign-in) and retrieval across multiple tiers (
BackupAgentand LauncherActivity), this prevents code duplication. - Do remind the developer of the critical guidelines for implementing the backend once you're done with the implementation.
- Do generate a separate restore key for each application if the organization has multiple apps with different package names, as a restore key is tied to a unique application package name.
DON'T:
- DON'T change the value of
allowBackupinAndroidManifest.xml. Restore Credenti
Pertanyaan umum
Apakah skill ini membangun server saya?
Tidak. Skill hanya mencakup sisi aplikasi Android dan mengingatkan Anda untuk membangun pemeriksaan backend sendiri.
Apakah ia mengubah layar masuk saya?
Tidak. Fitur ini berjalan bersama proses masuk yang sudah ada dan tidak memerlukan perubahan UI.
Pustaka mana yang dipakai?
Ia memakai pustaka androidx.credentials dari Credential Manager API.
Detail
Deskripsi asli dari pembuat
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.
repo: android/skills
Popularitas
- Bintang GitHub
- 10k
- Peringkat
- #11916
- Lisensi
- Apache-2.0
- Diperbarui
- 29/10/2026
Komentar
- …
Skill lain dari repositori ini
agp-9-upgrade
10kMembantu agent Anda meningkatkan aplikasi Android ke Android Gradle Plugin 9 dan menangani perubahan yang merusak. Tidak untuk proyek multiplatform.
camerax
10kMembantu agent Anda membangun fitur kamera Android dengan CameraX, termasuk perekaman video, kontrol perangkat keras, serta efek ML Kit dan Media3.
android-for-cars-parked-apps
10kMembantu agent Anda menyesuaikan aplikasi video, game, atau browser Android agar bisa berjalan sebagai aplikasi parkir di Android Auto dan Android Automotive.
appfunctions
10kMembantu agent Anda menemukan alur kerja utama dalam aplikasi Android dan menyediakannya sebagai AppFunctions yang bisa dijalankan agent AI dan perintah suara.
Skill serupa
reverse-engineer-anything
422kMembantu agent Anda memeriksa aplikasi dan paket yang sudah dirilis untuk menjelaskan fitur, membandingkan versi, atau memandu pembangunan ulang dengan alat REA.
1password
394kMembantu agent Anda mengatur CLI 1Password, masuk, serta membaca atau menyisipkan rahasia tanpa menampilkan nilainya di chat.
healthcheck
394kMembantu agent Anda mengaudit komputer atau server OpenClaw dari risiko keamanan seperti SSH, firewall, pembaruan, dan cadangan, lalu menyarankan perbaikan aman.