spgodara
spgodara

Reputation: 1084

System authentication in Android app

I want to authenticate my Android app using pin/password set for device security/lock screen. Is there any way to achieve this? May be, app will launch some system Activity, which will prompt for password. The system Activity should return success/failure.

Upvotes: 1

Views: 929

Answers (2)

cmoaciopm
cmoaciopm

Reputation: 2246

Began from Android 5.0, you can use KeyguardManager.createConfirmDeviceCredentialIntent()

This method will create an Intent, which can be used to start system authentication (pin / pattern / password).

For more information, refer doc and Confirm Credential sample.

Upvotes: 2

Galax
Galax

Reputation: 365

          App Start
(Is password already created?)  <--check in sharedPreferences(This is a good way to store info)
Yes                        No
Prompt for pass       Prompt for creation
Login if correct      Login

To do this you can use SharedPreferences, once you have stored a key you can retrieve it on app start up to decide what to do.

Upvotes: 0

Related Questions