Skip to Content
Platform.Ontology

Device lock and passcode state

Reads whether the phone has a screen lock and whether it is locked.

Gets silentlySign in and identitySecurity stateAndroid and iPhoneWhen the app opensWhile you use it

In one line

Can tell if your phone has a screen lock and whether it is locked now

Reads whether the phone has a screen lock and whether it is locked.

A phone with no lock is a risk flag; banking apps change flows on it.

What it can and can't do

What the user does: Nothing. It happens when the app checks device security

It can

  • Check if the phone is protected by a PIN, pattern, password or biometric
  • Check if the screen is locked right now (Android)
  • Use the answer to allow or refuse sensitive features
  • On iPhone, guess that a passcode exists by trying to save a protected item

It cannot

  • See your PIN, pattern or passcode
  • Unlock the phone
  • On iPhone, ask directly whether a passcode is set; there is no direct way to ask

How it differs between platforms: Android answers directly. iPhone has no direct question, so apps use an indirect test.

On Android and iPhone

AndroidiPhone
StatusSupportedPartial
First versionAndroid 1.5 (API 3)iOS 4.0
Permission or entitlementNot listednone
Protection levelnonenone
How access is grantednonenone
What the user seesNot listedNot listed
How long it lastsNot listedNot listed
How to take it backNot listedNot listed
Store policyNone listedNone listed
APIKeyguardManager.isDeviceSecure(), isKeyguardLocked(), isDeviceLocked()No direct passcode-set API; probe by saving a Keychain item that needs a passcode
NotesisDeviceSecure API 23None

Data you get

What comes back: Lock state
Shape: boolean
How often: On check

FieldTypeUnitRangePrecision
securebooleanNonetrue, false1 bit

Technical limits

  • iOS probe is indirect

The story

What it is

An app can tell whether your phone has a screen lock and whether it is locked right now.

For you

You do not see this check. You notice only that some apps, like a wallet or work app, refuse to run until you set a screen lock. Some also hide your data the moment the phone locks.

For makers

Apps that hold money or private data want a lock on the phone before they show it. It is cheap to check and lowers the chance that a lost phone becomes a stolen account.

Where you see it

TypeExampleApps
bankingA bank app will not open on a phone with no passcode, because anyone who picks it up could move money.None named
paymentsA mobile wallet asks you to set a screen lock before it will store a card for tap to pay.Google Wallet
enterpriseA work email app blocks company mail on any phone that has no screen lock, as set by IT.Microsoft Outlook, Intune Company Portal
healthA health app holding test results refuses to show them on an unlocked phone, or locks itself after a short time.None named
smart-homeA smart lock app only lets you issue a digital key if the phone itself is protected by a code.Apple Home, August
securityA fraud engine marks sessions from phones with no lock as higher risk and asks for extra proof.None named

Risks

  • Risk scoring of people
  • Reveals weak setup

Android and iPhone in short

  • Android: Android apps can ask if a lock is set (KeyguardManager) and whether the device is currently locked.
  • iPhone: iPhone apps can learn whether a passcode is set only indirectly, by asking the system to check, and cannot see the lock status itself.

What the platform says

Good uses and abuse

Legitimate uses

  • Risk signals

Known abuse

  • Little

Scores

ScoreValueMeaning
Sensitivity2 of 5How revealing the data is
Utility3 of 5How useful it is to honest apps
Friction0 of 5How much the user has to do
Fingerprint bits1Rough identifying entropy, when known

Sources

How well checked: Based on official documentation.

On this page