Android — Make app locking mechanism to protect app from illegal operations by third party when app come back to the foreground
Protect application with Biometric API and device credentials.
Motivation
In the development of apps that are categorized into finance and apps that handle personal informations and etc…
These apps are often required to have a feature that prevents illegal operation by a third party.
Therefore I created app lock screen that appears when app come back to the foreground using ActivityLifecycleCallbacks and ProcessLifecycleOwner.
Core libraries
- ProcessLifecycleOwner (detect process state. background/foreground)
- ActivityLifeclcleCallbacks
- Biometric (to use the biometric API and device credentials)
- Dagger (for dependency injection)
Behaviors
Dependencies
// lifecycle
def lifecycle_version = "2.2.0"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-process:$lifecycle_version"
// dagger
implementation "com.google.dagger:dagger:2.29.1"
implementation "com.google.dagger:dagger-android-support:2.29.1"
kapt "com.google.dagger:dagger-compiler:2.29.1"
kapt "com.google.dagger:dagger-android-processor:2.29.1"
// biometric prompt
implementation "androidx.biometric:biometric:1.1.0"