Secure Preference Manager for android. It uses various Encryption to protect your application’s Shared Preferences.
Secure Preference Manager for android. It uses various encryption techniques to protect your application’s Shared Preferences.
Add jitpack to your project’s repositories.
repositories {
// ...
maven { url "https://jitpack.io" }
}
Then add Secure-Pref-Manager to your Module’s dependencies
dependencies {
compile 'com.github.prashantsolanki3:Secure-Pref-Manager:0.25'
}
new SecurePrefManagerInit.Initializer(getApplicationContext())
.initialize();
new SecurePrefManagerInit.Initializer(getApplicationContext())
.useEncryption(true)
.initialize();
new SecurePrefManagerInit.Initializer(getApplicationContext())
.useEncryption(true)
.setCustomEncryption(new Encryptor(getApplicationContext()) {
@Override
public String encrypt(String s) throws Exception {
// Your Encryption Algorithm
return encryptedString;
}
@Override
public String decrypt(String s) throws Exception {
// Your Decryption Algorithm
return decryptedString;
}
})
.initialize();
SecurePrefManager.with(this)
.set("user_name")
.value("LoremIpsum")
.go();
String userName = SecurePrefManager.with(this)
.get("user_name")
.defaultValue("unknown")
.go();
@Override
protected void onStart() {
super.onStart();
SecurePrefManager.with(getApplicationContext())
.unhide(new HidePreferences.PreferenceUpdateListener() {
@Override
public void onFailure() {
Log.d("unhiding", "Failed");
}
@Override
public void onProgress(int p, int max) {
Log.d("unhiding", "Progress: " + p + "/" + max);
}
@Override
public void onSuccess() {
Log.d("unhiding", "Success");
}
});
}
@Override
protected void onPause() {
SecurePrefManager.with(getApplicationContext())
.hide(new HidePreferences.PreferenceUpdateListener() {
@Override
public void onFailure() {
}
@Override
public void onProgress(int p, int max) {
}
@Override
public void onSuccess() {
}
});
}