Skip to content

Secure , Fast and Easy library for Android that encrypts the values of Shared Preferences .

Notifications You must be signed in to change notification settings

mehdi-ghorbani97/secure_pref

Repository files navigation

Secure Pref - Secure Shared Preference Library for Android

a android library wich allows to insert data to shared preference fast and scure with flexibility.It also use MCrypt to encrypt data.

Installation

  1. Add https://jitpack.io to your project.

    allprojects {
       repositories {
          jcenter()
          maven { url "https://jitpack.io" }
       }
    }
    
  2. Include the library in your build.gradle

dependencies{
    implementation 'com.github.mehdi-ghorbani97:secure_pref:1.0'
}

Setup

Initialize the shared preference inside the onCreate of the Application class of your app :

public class App extends Application {

   @Override
   public void onCreate() {
       super.onCreate();
       // Initialize the SecurePref class
   // SecurePref.initialize(context , random 15 character string , random 15 character string);
   SecurePref.initialize(getApplicationContext(), "Hu27jf!:nV,K6C78", "_].MF6p#N7K*b^3j");
   
   
   }
}

Usage

After initialization, you can use simple one-line methods to save values to the shared preferences anywhere in your app, such as:

  • SecurePref.putString(key, string)
  • SecurePref.putLong(key, long)
  • SecurePref.putBoolean(key, boolean)

Retrieving data from the Shared Preferences can be as simple as:

String data = SecurePref.getString(key, default value)

Contact

Please fell free to contact me if there is any problem when using the library.

About

Secure , Fast and Easy library for Android that encrypts the values of Shared Preferences .

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages