【问题标题】:Is there a "Wrong password on lock screen" action intent?是否存在“锁定屏幕上的错误密码”操作意图?
【发布时间】:2012-05-22 07:18:12
【问题描述】:

如果用户在 Android 锁定屏幕(系统锁定屏幕 - 不是我自己的应用程序中的锁定屏幕)上输入错误密码,我正在寻找一种方法来获取通知。是否存在在这种情况下被触发的现有意图?

非常感谢您。

【问题讨论】:

  • 你能实现它吗?我需要一些帮助。

标签: android android-intent lockscreen


【解决方案1】:

如果用户在 Android 锁定屏幕(系统锁定屏幕 - 不是我自己的应用程序中的锁定屏幕)上输入错误密码,我正在寻找一种方法来获取通知。在这种情况下是否存在被触发的现有意图?

如果您使用设备管理 API 实现了 DeviceAdminReceiver,它将使用 onPasswordFailed() 调用。

【讨论】:

    【解决方案2】:

    您可以在 android 应用程序中创建自己的对话框来显示错误消息。下面是代码:

    AlertDialog alertDialog = new AlertDialog.Builder(LoginActivity.this).create();
                            // Setting Dialog Title
                            alertDialog.setTitle("Error");
                            // Setting Dialog Message
                            alertDialog.setMessage("Not A User");
                            // Setting Icon to Dialog
                            alertDialog.setIcon(R.drawable.inputerror);
                            // Setting OK Button
                            alertDialog.setButton("OK",new DialogInterface.OnClickListener() 
                            {
                                public void onClick(DialogInterface dialog, int which) 
                                {
                                    // Write your code here to execute after dialog
                                    // closed
                                    Toast.makeText(getApplicationContext(),"Not A Valid User", Toast.LENGTH_SHORT).show();
                                }
                            });
                            // Showing Alert Message
                            alertDialog.show();
                            return;
    

    【讨论】:

    • 我说的是安卓锁屏。您可以在 Android 设置中设置密码。如果设置了此密码,您需要输入此密码才能对该设备进行任何操作。
    猜你喜欢
    • 1970-01-01
    • 2022-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多