简体   繁体   English

锁屏+密码锁定Android

[英]Lock Screen + Password lock Android

I'm developing a security enhancement android application. 我正在开发一个安全性增强的android应用程序。 There is a need to lock the android phone, hence using Device admin and it works fine. 有必要锁定android手机,因此使用Device admin,它可以正常工作。

But, when setting a password, i'm in need of using Intents or i'm navigated to in-built UI screens to enter password. 但是,设置密码时,我需要使用Intent,或者导航到内置的UI屏幕以输入密码。

Intent intent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD); startActivity(intent);

Is there any way to set password without using default screens / without UI ? 有没有可以在不使用默认屏幕/没有UI的情况下设置密码的方法?

Kindly help me.. 请帮助我。

DevicePolicyManager DPM = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
String pw = "abcd123";
DPM.resetPassword(pw, DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY);

Not sure this is what you need but it's how I set passwords for the user. 不确定这是否是您需要的,但这是我为用户设置密码的方式。

No - and the reason for this is that from Google's perspective (your requirements may vary, but you're in the minority) the user should always have a chance to know the password for their device. 否-原因是从Google的角度(您的要求可能有所不同,但您属于少数),用户应该始终有机会知道其设备的密码。 Allowing an application, even as a Device Policy Manager, to change the password without user input could lock a user out of the device they might need to function without them understanding why, which is a very poor UX design. 允许应用程序(即使作为设备策略管理器)在没有用户输入的情况下更改密码也可能将用户锁定在他们可能不知道为什么运行的设备之外,这是非常糟糕的UX设计。 You can reset the user's password, or, as you've already noted, launch the screens to help them change their password but that's the best you're going to be able to manage without a custom build of the OS. 您可以重设用户的密码,或者如您已经提到的,启动屏幕以帮助他们更改密码,但这是您无需自定义操作系统即可进行管理的最佳选择。

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

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