AndroidAppLockscreen
Android app lock screen library. Add a 4 to 8 digit passcode lock to your app in a few lines, with fingerprint unlock and light and dark mode
- Platform
- Libraries
- Category
- Developer Tools
- Available from
- GitHub
About this app
AndroidAppLockscreen adds a passcode lock screen to your Android app. Building one yourself means designing a keypad, storing the passcode safely and locking again whenever people come back to the app. With this library it takes a few lines: your app asks for a 4 to 8 digit passcode when it opens and every time someone returns to it. It was revamped in 2026: rewritten in Kotlin, with a Material 3 look that follows light and dark mode, and it still works from Java.
I made it so I could use it in all my apps: an easy way to add password protection to every Android app I make.
- A clean lock screen with round number keys, dots that fill in as you type, a shake and a small vibration on a wrong passcode.
- Set, change or turn off the passcode with one call each.
- Fingerprint or face unlock, turned on with one line.
- Locks again when people leave the app and come back.
- Passcodes are stored as a salted hash, not as plain text.
- Your own look if you want it: pass your own theme or background colour. On Android 12 and newer it uses the phone's own colours.
- "Forgot passcode?" button that runs your own code.
Great for diary, notes, finance or any app that should ask for a passcode before it opens.
Install
Add JitPack to your repositories, then the dependency:
// settings.gradle.kts
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven("https://jitpack.io")
}
}
dependencies {
implementation("com.github.p32929:AndroidAppLockscreen:2.0.0")
}
class MainActivity : LockscreenHandler() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
if (savedInstanceState == null) EasyLock.checkPassword(this)
}
}
EasyLock.setPassword(this) // set a passcode
EasyLock.setBiometricEnabled(true) // allow fingerprint unlock
Upgrading from 1.x? Your old calls keep working and saved passcodes still unlock. See "Migrating from 1.x" on the GitHub page.
Want a lock screen that matches your app's look? Contact me through my portfolio: https://p32929.github.io