0

I am trying to create a custom android screen with unlock option ( basically something that overrides the default unlock screen and that overrides the slide unlock button). On unlocking it should direct to the keypad for entering pass code and behave in the default way. I tried creating this with widget but unable to find a way to add this like a unlock screen. Any help would be appreciated.I am using android studio.

Milee
  • 1,191
  • 1
  • 11
  • 29
  • There are alot of questions about that already... take a look around [link1](http://stackoverflow.com/questions/20943407/create-an-android-lock-screen), [link2](http://stackoverflow.com/questions/10864300/create-a-lock-screen-of-my-own), [link3](http://stackoverflow.com/questions/21983462/creating-custom-lockscreen-in-android),... – Marko Nov 03 '15 at 08:19

1 Answers1

1

Here is a good example of what you are looking for. https://github.com/googlesamples/android-ConfirmCredential

private void showAuthenticationScreen() {
    // Create the Confirm Credentials screen. You can customize the title and description. Or
    // we will provide a generic one for you if you leave it null
    Intent intent = mKeyguardManager.createConfirmDeviceCredentialIntent(null, null);
    if (intent != null) {
        startActivityForResult(intent, REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS);
    }
}

This is the small code for the opening intent for result and getting authentication. But I would suggest try downloading code and have a look at it.

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS) {
        // Challenge completed, proceed with using cipher
        if (resultCode == RESULT_OK) {
            if (tryEncrypt()) {
                showPurchaseConfirmation();
            }
        } else {
            // The user canceled or didn’t complete the lock screen
            // operation. Go to error/cancellation flow.
        }
    }
}
Tushar Sheth
  • 391
  • 4
  • 18