EncryptionState
The state of the encryption of the link with a peripheral.
Having the bond information (Peripheral.hasBondInformation) does not mean that the link is encrypted: the bond information is stored by this Android device, whether the peripheral is connected or not. A bonded peripheral should encrypt the link right after connecting, but it may fail to do so, for example when the peripheral lost the keys. Use this state to check that the connection is secure.
The state is reported from Android 16 (API 36). Earlier versions do not tell whether the link is encrypted, and the state is Unknown. Note, that old Android versions did not require encryption to be resumed when connecting to a bonded device, so a device could pretend to be another one, and use an unencrypted link.
See also
Inheritors
Types
The encryption algorithm.
The link is encrypted.
The link is not encrypted.
It is not known whether the link is encrypted.