- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 Android 应用程序,它显示一个图标,上面写着“设备应使用 PIN 或模式进行保护”。然后用户转到“设置”并为其设备启用 PIN 码或图案,然后返回到应用程序。仍然显示该图标。我如何监听此事件并禁用图标?
该图标仅在应用终止并重新启动后消失。
最佳答案
我认为没有针对此类问题的任何事件监听器。
你可以做的是你可以在每次应用onResume()时检查它。
通过对以下代码进行一些操作。
public class LockType
{
private final static String PASSWORD_TYPE_KEY = "lockscreen.password_type";
/**
* This constant means that android using some unlock method not described here.
* Possible new methods would be added in the future releases.
*/
public final static int SOMETHING_ELSE = 0;
/**
* Android using "None" or "Slide" unlock method. It seems there is no way to determine which method exactly used.
* In both cases you'll get "PASSWORD_QUALITY_SOMETHING" and "LOCK_PATTERN_ENABLED" == 0.
*/
public final static int NONE_OR_SLIDER = 1;
/**
* Android using "Face Unlock" with "Pattern" as additional unlock method. Android don't allow you to select
* "Face Unlock" without additional unlock method.
*/
public final static int FACE_WITH_PATTERN = 3;
/**
* Android using "Face Unlock" with "PIN" as additional unlock method. Android don't allow you to select
* "Face Unlock" without additional unlock method.
*/
public final static int FACE_WITH_PIN = 4;
/**
* Android using "Face Unlock" with some additional unlock method not described here.
* Possible new methods would be added in the future releases. Values from 5 to 8 reserved for this situation.
*/
public final static int FACE_WITH_SOMETHING_ELSE = 9;
/**
* Android using "Pattern" unlock method.
*/
public final static int PATTERN = 10;
/**
* Android using "PIN" unlock method.
*/
public final static int PIN = 11;
/**
* Android using "Password" unlock method with password containing only letters.
*/
public final static int PASSWORD_ALPHABETIC = 12;
/**
* Android using "Password" unlock method with password containing both letters and numbers.
*/
public final static int PASSWORD_ALPHANUMERIC = 13;
/**
* Returns current unlock method as integer value. You can see all possible values above
* @param contentResolver we need to pass ContentResolver to Settings.Secure.getLong(...) and
* Settings.Secure.getInt(...)
* @return current unlock method as integer value
*/
public static int getCurrent(ContentResolver contentResolver)
{
long mode = android.provider.Settings.Secure.getLong(contentResolver, PASSWORD_TYPE_KEY,
DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
if (mode == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING)
{
if (android.provider.Settings.Secure.getInt(contentResolver, Settings.Secure.LOCK_PATTERN_ENABLED, 0) == 1)
{
return LockType.PATTERN;
}
else return LockType.NONE_OR_SLIDER;
}
else if (mode == DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK)
{
String dataDirPath = Environment.getDataDirectory().getAbsolutePath();
if (nonEmptyFileExists(dataDirPath + "/system/gesture.key"))
{
return LockType.FACE_WITH_PATTERN;
}
else if (nonEmptyFileExists(dataDirPath + "/system/password.key"))
{
return LockType.FACE_WITH_PIN;
}
else return FACE_WITH_SOMETHING_ELSE;
}
else if (mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC)
{
return LockType.PASSWORD_ALPHANUMERIC;
}
else if (mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC)
{
return LockType.PASSWORD_ALPHABETIC;
}
else if (mode == DevicePolicyManager.PASSWORD_QUALITY_NUMERIC)
{
return LockType.PIN;
}
else return LockType.SOMETHING_ELSE;
}
private static boolean nonEmptyFileExists(String filename)
{
File file = new File(filename);
return file.exists() && file.length() > 0;
}
}
关于Android PIN 或模式更改监听器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41591692/
我正在使用 - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id ) annotation{ 为自定义图钉
试图了解Box::pin()和Pin::new_unchecked()之间的区别。假设以下代码: use std::pin::Pin; use std::marker::PhantomPinned;
我有最新版本的 Intel Pin 3.0 版本 76887。 我有一个支持 MPX 的玩具示例: #include int g[10]; int main(int argc, char **arg
我正在寻找一种算法来创建类似于预付费电话卡的安全唯一随机数。我确实看过Generating a unique 15 digite Pin code from a 10digit number但它确实让
作为Hans Passant wishes这是我的场景。我有一个混合模式应用程序,其中 native 代码完成所有艰苦的工作,同时尊重性能,托管代码仅负责 GUI。用户也将通过编写他们专有的 C# 代
我正在尝试解决一个我不确定如何解决的问题。在我的应用程序中,本地图套件启动时,我会在用户的当前位置放置一个图钉。 Mapkit 委托(delegate)给 viewForAnnotation,它设置了
我在 android 应用程序中集成了 admob,我达到了阈值。它会显示一条消息,您的付款目前处于暂停状态,因为您尚未验证您的地址 有什么方法可以避免等待数周才能从 admob 收到用于地址验证的
我正在使用 get_user_pages在 Linux 内核驱动程序中,为了 [硬件] DMA 固定内存。一切似乎都很好 - 但我很难证明“固定”正在做正确的事情。 当我在做 get_user_pag
在使用 MKMapView 时,我确实注意到了 IOS 11 上的一个问题。 当我想从图钉对话框中点击按钮 Action 并且按钮 Action 后面有另一个图钉时,它没有得到手势。 应该是zPosi
我是 PIN 工具的新手。我只是尝试运行自述文件中给出的示例代码。 最初我使用以下方式构建: $ cd source/tools/ManualExamples $ make all 它正确编译并创建了
我遇到一个小问题...我有自己的网站,带有一个简单的 mysqli 登录脚本,每当我输入用户名、密码和 PIN 码时,它都会让我登录... 我现在的问题是,我可以仅使用用户名和密码登录我的网站(无需输
我有一个显示现金点位置的 map View 。注释被删除,可以单击标注以转到包含有关该位置的更多详细信息的页面。提款机分为免费和付费两种,免费的提款机别针是绿色的,另一个是红色的。当别针掉落时,它们就
我正在构建一个带有 GSM 调制解调器和 SIM 卡的设备。我想用别针保护 SIM 卡,以防止在现场安装设备时误用。 将关联 SIM 卡的 PIN 码存储到每个设备中会很麻烦。此外,如果更换 SIM
我正在编写一个需要共享流所有权的流适配器。 将流(私下)存储在 Pin>> 中是否正确? ? 如何调用poll_next(self: Pin在流? 最佳答案 Mutex没有所谓的结构钉扎,这在 std
我对 Pin 的要求感到困惑那个 a value, once pinned, must remain pinned forever. 我看到了the discussion thread on redd
我目前正在实现 TrustKit framework在我的 iOS 应用程序中为 SSL 连接启用 SPKI 固定。我偶然发现了正确配置 TrustKit 所必需的“备用密码”。不幸的是,API 文档
在 rust 中学习 Pin 的实现时我很困惑。 我知道当一个类型不能安全移动时,它可以实现 !Unpin。 Pin 是为了防止别人从这些类型中获取到&mut T,使他们不能是std::mem::sw
我用的是 SIM868 模块,我用的是我常用的 SIM 卡,没有问题,但现在我买了一张新的 SIM 卡,没有 pin。我需要添加 PIN 码以提高安全性。 我使用以下命令检查了它是否没有启用 PIN:
我想知道是否可以在自定义 MKMapView 中创建 MKPinAnnotation,它可以像 map 应用程序中的“Drop Pin”注释一样响应触摸和拖动。 我想要一种在 GPS 给出的位置放置图
我正在开发一个应用程序,我需要通过为用户设置密码/密码/密码来设置安全功能,以便每当他们从后台打开应用程序时,应用程序都会要求输入密码/密码/密码。我阅读了一些文章/解决方案,例如 this但他们没有
我是一名优秀的程序员,十分优秀!