Class BiometricsSharedPrefs


  • public class BiometricsSharedPrefs
    extends java.lang.Object
    Shared preferences class for Biometrics This is responsible for saving and retrieving biometric data from Shared Preferences.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void clearSharedPreferences​(android.content.Context context)
      Clears all shared preferences
      static void clearSharedPreferenceString​(android.content.Context context, java.lang.String key)
      Clear specific shared preferences string
      static java.lang.String getBiometricsData​(android.content.Context context)
      Retrieve value under BIOMETRICS_DATA
      static java.lang.String getEmail​(android.content.Context context)
      Retrieve value under EMAIL
      static java.lang.String getPassword​(android.content.Context context)
      Retrieve value under PASSWORD
      static boolean getSharedPreferenceBoolean​(android.content.Context context, java.lang.String key)
      Get a boolean shared preference
      static java.lang.String getSharedPreferenceString​(android.content.Context context, java.lang.String key, java.lang.String defValue)
      Get a string shared preference
      static boolean hasBiometricsData​(android.content.Context context)
      Retrieve value under BIOMETRICS_DATA
      static boolean isBiometricsEnabled​(android.content.Context context)
      Retrieve value under ENABLE_BIOMETRICS
      static void setBiometricsData​(android.content.Context context, java.lang.String fingerprintData)
      Store a value under BIOMETRICS_DATA
      static void setEmail​(android.content.Context context, java.lang.String email)
      Store a value under EMAIL
      static void setEnableBiometrics​(android.content.Context context, boolean value)
      Store a value under BIOMETRICS_DATA
      static void setPassword​(android.content.Context context, java.lang.String password)
      Store a value under PASSWORD
      static void setSharedPreferenceBoolean​(android.content.Context context, java.lang.String key, boolean value)
      Set a boolean shared preference
      static void setSharedPreferenceString​(android.content.Context context, java.lang.String key, java.lang.String value)
      Set a string shared preference
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BiometricsSharedPrefs

        public BiometricsSharedPrefs()
    • Method Detail

      • setSharedPreferenceString

        public static void setSharedPreferenceString​(android.content.Context context,
                                                     java.lang.String key,
                                                     java.lang.String value)
        Set a string shared preference
        Parameters:
        context - context to access the shared preference
        key - Key to set shared preference
        value - Value for the key
      • setSharedPreferenceBoolean

        public static void setSharedPreferenceBoolean​(android.content.Context context,
                                                      java.lang.String key,
                                                      boolean value)
        Set a boolean shared preference
        Parameters:
        context - context to access the shared preference
        key - Key to set shared preference
        value - Value for the key
      • getSharedPreferenceBoolean

        public static boolean getSharedPreferenceBoolean​(android.content.Context context,
                                                         java.lang.String key)
        Get a boolean shared preference
        Parameters:
        context - context to access the shared preference
        key - Key to look up in shared preferences.
        Returns:
        true if found, if set to false.
      • getSharedPreferenceString

        public static java.lang.String getSharedPreferenceString​(android.content.Context context,
                                                                 java.lang.String key,
                                                                 java.lang.String defValue)
        Get a string shared preference
        Parameters:
        context - context to access the shared preference
        key - unique identifier reading string data
        defValue - Default value to be returned if shared preference isn't found.
        Returns:
        String containing value of the shared preference if found, else the default value
      • clearSharedPreferenceString

        public static void clearSharedPreferenceString​(android.content.Context context,
                                                       java.lang.String key)
        Clear specific shared preferences string
        Parameters:
        context - context to access the shared preference
        key - Key to look up in shared preferences.
      • clearSharedPreferences

        public static void clearSharedPreferences​(android.content.Context context)
        Clears all shared preferences
        Parameters:
        context - context to access the shared preference
      • hasBiometricsData

        public static boolean hasBiometricsData​(android.content.Context context)
        Retrieve value under BIOMETRICS_DATA
        Parameters:
        context - context to access the shared preference
        Returns:
        true if has biometric data else false
      • setEmail

        public static void setEmail​(android.content.Context context,
                                    java.lang.String email)
        Store a value under EMAIL
        Parameters:
        context - context to access the shared preference
        email - value to store in EMAIL
      • setPassword

        public static void setPassword​(android.content.Context context,
                                       java.lang.String password)
        Store a value under PASSWORD
        Parameters:
        context - context to access the shared preference
        password - value to store in PASSWORD
      • setBiometricsData

        public static void setBiometricsData​(android.content.Context context,
                                             java.lang.String fingerprintData)
        Store a value under BIOMETRICS_DATA
        Parameters:
        context - context to access the shared preference
        fingerprintData - value to store in BIOMETRICS_DATA
      • setEnableBiometrics

        public static void setEnableBiometrics​(android.content.Context context,
                                               boolean value)
        Store a value under BIOMETRICS_DATA
        Parameters:
        context - context to access the shared preference
        value - value to store in ENABLE_BIOMETRICS
      • getEmail

        public static java.lang.String getEmail​(android.content.Context context)
        Retrieve value under EMAIL
        Parameters:
        context - context to access the shared preference
        Returns:
        value stored under EMAIL
      • getPassword

        public static java.lang.String getPassword​(android.content.Context context)
        Retrieve value under PASSWORD
        Parameters:
        context - context to access the shared preference
        Returns:
        value stored under PASSWORD
      • getBiometricsData

        public static java.lang.String getBiometricsData​(android.content.Context context)
        Retrieve value under BIOMETRICS_DATA
        Parameters:
        context - context to access the shared preference
        Returns:
        value stored under BIOMETRICS_DATA
      • isBiometricsEnabled

        public static boolean isBiometricsEnabled​(android.content.Context context)
        Retrieve value under ENABLE_BIOMETRICS
        Parameters:
        context - context to access the shared preference
        Returns:
        value stored under ENABLE_BIOMETRICS