I want to check if the user has any type of screen lock set on their device (PIN, fingerprint, face, pattern, etc.).
I don't want to simply check if the device is capable of for example biometrics, nor detect (from the background) if the device is currently locked. I want to know if the user has configured any kind of lock mechanism at all for their device.
All the resources and code snippets I've come across so far seem to focus on
- checking if the device has biometric capabilities, or
- actually requesting authentication using biometric/PIN/pattern, or
- checking if the device is currently locked (when the app is in the background)
I want to simply check if the device has any type of locking configured and required to unlock the phone. If it doesn't, I want to hide some sensitive information in my app.
Is there any way to do this on both Android and iOS?
isDeviceSupported()
checks for hardware support.canCheckBiometrics
checks if fingerprint/iris..etc are enrolled. andgetAvailableBiometrics()
sometimes returns empty [ ] when only pattern is present. so the options are very limited with local_auth – Sapient