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 : )
- Host: GitHub
- URL: https://github.com/kapilyadav-dev/prefs.io
- Owner: KapilYadav-dev
- Created: 2021-07-08T12:04:23.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-10-23T16:29:38.000Z (over 4 years ago)
- Last Synced: 2025-10-27T06:26:15.452Z (9 months ago)
- Topics: android-library, java, prefs, shared, sharedpreferences
- Language: Java
- Homepage:
- Size: 172 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
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)