0

I have implemented my own class, extending the DeviceAdminReceiver, given the app appropriate authorities to run this etc.

I have tried to display a message (as a simple Toast as below, and by starting a new activity) when user has entered wrong PIN, but I cannot get that working. The code executes as intended, but the messages are only showing up until after entering the correct PIN.

Are there any special tricks I need to do, or is this screen simply restricted in Android?

(probably I do not need to run the super.onPasswordFailed(), but please disregard from that now)

@Override
public void onPasswordFailed(Context context, Intent intent) {
    super.onPasswordFailed(context, intent);
    Log.i("MYAPP: ", "swDeviceAdminReceiver::onPasswordFailed");

    Toast.makeText(context, "Password failed", Toast.LENGTH_SHORT).show();
}
Gaston Flores
  • 2,457
  • 3
  • 23
  • 42
stoif
  • 1
  • 1
  • Are you sure that ´onPasswordFailed´ is firing? – faranjit Aug 01 '16 at 15:27
  • Yes. But I just found an answer to my problem,using the following in my activity onCreate did the trick: Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED) – stoif Aug 01 '16 at 15:48

0 Answers0