简体   繁体   English

如何触发 KeygaurdManager 以编程方式获取指纹

[英]How to trigger KeygaurdManager to take fingerprint programmatically

As soon as I receive a push notification from my app I want to trigger the KeyguardManager to launch the fingerprint/pass code screen to open the phone from lock screen so that person can enter the phone and unlock the device.一旦我收到来自我的应用程序的推送通知,我想触发 KeyguardManager 启动指纹/密码屏幕以从锁定屏幕打开手机,以便人们可以进入手机并解锁设备。 I want to trigger this programmatically similar to when we click on any notification from lock screen we get the fingerprint/pass-code screen.我想以编程方式触发此操作,类似于当我们单击锁定屏幕上的任何通知时,我们会获得指纹/密码屏幕。

I did a lot of RnD but didn't find any solution, this is one of the challenging use case task given to me in class, I have been exploring a lot from quite few weeks with no success at all.我做了很多 RnD,但没有找到任何解决方案,这是 class 给我的具有挑战性的用例任务之一,我从几个星期以来一直在探索很多,但根本没有成功。 Did tried Broadcast receiver with BiometricManager and many things with no success, any lead will be very helpful.是否尝试过使用 BiometricManager 的广播接收器,但很多事情都没有成功,任何线索都会非常有帮助。

As soon as you receive push message, onNotificationReceived() (or some other method if you use some 3rd party libs) method gets called as below.一旦您收到推送消息, onNotificationReceived() (或其他方法,如果您使用某些 3rd 方库)方法将被调用如下。 from there, you can launch your Main screen where you have written biometric/unlocking code.从那里,您可以启动您已编写生物识别/解锁代码的主屏幕。

class MyReceiver : PushReceiver {

    override fun onNotificationReceived(message: Message) : Boolean {
        //Launch your MainActivity where you can show Unlock screen.
          return super.onNotificationReceived(message);
    }

 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM