The PingOne Verify SDK uses EncryptedPreferences to store the entity information and Claims on the device. EncryptedPreferences used for the SDK storage works in conjunction with the device authentication, using either biometrics or device credentials. If biometrics is disabled or no biometrics are enrolled, to be able to use the SDK, the device must have a passcode enabled.

The following methods provide a simple interface to create EncryptedSharedPreferences with or without requiring device authentication. See the Android documentation EncryptedSharedPreferences for more information.

Secure storage without authentication

To use the device’s secure storage without authentication, use coding similar to this:

EncryptedPreferences.create(PREFERENCES_FILE_NAME, 
    (sharedPreferences) -> {
      //Use preferences here
    },
    (error) -> {
      //Handle preference initialization error here
    });

Secure storage with authentication

To use the device’s secure storage with authentication, you’ll need to pass the Fragment or the FragmentActivity that will be used to display the system authentication dialog. For example:

EncryptedPreferences.createAuthenticated(YOUR_FRAGMENT or FRAGMENTACTIVITY, PREFERENCES_FILE_NAME, 
    (sharedPreferences) -> {
      //Use preferences here
    },
    (error) -> {
      //Handle preference initialization error here
    });