An open API service indexing awesome lists of open source software.

https://github.com/kapilyadav-dev/prefs.io

An easy Shared Prefs library with more options : )
https://github.com/kapilyadav-dev/prefs.io

android-library java prefs shared sharedpreferences

Last synced: 21 days ago
JSON representation

An easy Shared Prefs library with more options : )

Awesome Lists containing this project

README

          

# Prefs.io
A small and easy Shared Prefs library with more options : )

# Implementation

Add jitpack to your maven sources


allprojects {

repositories {
...
maven { url "https://jitpack.io" }
}
}

Add Censory as a dependency to your build.gradle


dependencies {

implementation 'com.github.KapilYadav-dev:Prefs.io:CURRENT_RELEASE'
}

# Usage
1) Initialization ( in application class )
2) Use it 👨🏽‍💻

# Initialization

@Override
public void onCreate() {
super.onCreate();
// Initialize the Prefs class
SharedPrefs.init(this);
}

# Use it
After initialization, you can use simple one-line methods to save and get those values from the shared preferences anywhere in your app, such as:


  • SharedPrefs.setString(key, string)

  • SharedPrefs.getString(key, defaultString")

  • SharedPrefs.setInteger(key, int)

  • SharedPrefs.getInteger(key, defaultInt)

  • SharedPrefs.setboolean(key, boolean)

  • SharedPrefs.getboolean(key, defaultBoolean)

# Use it with encryption
## It's a better practice to encrypt down your sharedPrefs so that it can't be altered by Root Piratess 🏴‍☠️



  • SharedPrefs.setString(key, string, encryptionKey) // This will encrypt your String 🤐


  • SharedPrefs.getString(key, defaultString, encryptionKey, encryptedText) // This will decrypt down your encrypted String 😎

# Snapping the fingers 🔥 ( Clearing all data )



  • SharedPrefs.clear(context)