Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
事情是这样的——我正在做一个安全应用程序,它需要能够检查是否设置了 PIN 码。无论 PIN 状态如何,官方 API 都会返回相同的值,我一直在尝试使用 ITelephony,但似乎无法使其正常工作。请问有什么帮助吗?
解决方法!
@override protected void onPause() { super.onPause(); PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE); boolean isScreenOn = powerManager.isScreenOn(); if (!isScreenOn) { // do stuff... } }