android10 /
Android-CleanArchitecture-Kotlin
This is a movies sample app in Kotlin, which is part of a serie of blog posts I have written about architecting android application using different approaches.
80/100 healthLoading repository data…
lemonbabu / repository
This is an Java and kotlin solution for android SQLite database backup and restore system using AES encryption
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Simple tool to backup and restore your room database in Android
Android-Room-Database-Backup library is pushed
to Maven Central
.
Add the dependency for Android-Room-Database-Backup to your app-level build.gradle file.
implementation 'de.raphaelebner:roomdatabasebackup:1.0.0-beta12'
Required
Current context
Attention
Must be declared outside of an onClickListener before lifecycle state changes to started
RoomBackup(this)
Instance of your room database
.database(*YourDatabase*.getInstance(this))
e.g. YourDatabase.kt
Optional
The following options are optional and the default options
Enable logging, for debugging and some error messages
.enableLogDebug(false)
Set custom log tag
.customLogTag("debug_RoomBackup")
Enable and set maxFileCount
.maxFileCount(5)
Encrypt your backup
.backupIsEncrypted(false)
Encrypt your backup with your own password / key
.backupIsEncrypted(true) is setAttention
i do not assume any liability for the loss of your key
.customEncryptPassword("YOUR_SECRET_PASSWORD")
Save your backup to different storage
RoomBackup.BACKUP_FILE_LOCATION_EXTERNALRoomBackup.BACKUP_FILE_LOCATION_INTERNALHere are all exit codes for the onCompleteListener.
They can be calles using OnCompleteListener.$NAME$
| Exit Code | Name | Description |
|---|---|---|
| 0 | EXIT_CODE_SUCCESS | No error, action successful |
| 1 | EXIT_CODE_ERROR | Other Error |
| 2 | EXIT_CODE_ERROR_BACKUP_FILE_CHOOSER | Error while choosing backup to restore. Maybe no file selected |
| 3 | EXIT_CODE_ERROR_BACKUP_FILE_CREATOR | Error while choosing backup file to create. Maybe no file selected |
| 4 | EXIT_CODE_ERROR_BACKUP_LOCATION_FILE_MISSING | [BACKUP_FILE_LOCATION_CUSTOM_FILE] is set but [RoomBackup.backupLocationCustomFile] is not set |
| 5 | EXIT_CODE_ERROR_BACKUP_LOCATION_MISSING | [RoomBackup.backupLocation] is not set |
| 6 | EXIT_CODE_ERROR_BY_USER_CANCELED | Restore dialog for internal/external storage was canceled by user |
| 7 | EXIT_CODE_ERROR_DECRYPTION_ERROR | Cannot decrypt provided backup file |
| 8 | EXIT_CODE_ERROR_ENCRYPTION_ERROR | Cannot encrypt database backup |
| 9 | EXIT_CODE_ERROR_RESTORE_BACKUP_IS_ENCRYPTED | You tried to restore a encrypted backup but [RoomBackup.backupIsEncrypted] is set to false |
| 10 | EXIT_CODE_ERROR_RESTORE_NO_BACKUPS_AVAILABLE | No backups to restore are available in internal/external sotrage |
| 11 | EXIT_CODE_ERROR_ROOM_DATABASE_MISSING | No room database to backup is provided |
| 12 | EXIT_CODE_ERROR_STORAGE_PERMISSONS_NOT_GRANTED | Storage permissions not granted for custom dialog |
| 13 | EXIT_CODE_ERROR_WRONG_DECRYPTION_PASSWORD | Cannot decrypt provided backup file because the password is incorrect |
val backup = RoomBackup(this)
...
backup
.database(FruitDatabase.getInstance(this))
.enableLogDebug(true)
.backupIsEncrypted(true)
.customEncryptPassword("YOUR_SECRET_PASSWORD")
.backupLocation(RoomBackup.BACKUP_FILE_LOCATION_INTERNAL)
.maxFileCount(5)
.apply {
onCompleteListener { success, message, exitCode ->
Log.d(TAG, "success: $success, message: $message, exitCode: $exitCode")
if (success) restartApp(Intent(this@MainActivity, MainActivity::class.java))
}
}
.backup()
val backup = RoomBackup(this)
...
backup
.database(FruitDatabase.getInstance(this))
.enableLogDebug(true)
.backupIsEncrypted(true)
.customEncryptPassword("YOUR_SECRET_PASSWORD")
.backupLocation(RoomBackup.BACKUP_FILE_LOCATION_INTERNAL)
.apply {
onCompleteListener { success, message, exitCode ->
Log.d(TAG, "success: $success, message: $message, exitCode: $exitCode")
if (success) restartApp(Intent(this@MainActivity, MainActivity::class.java))
}
}
.restore()
final RoomBackup roomBackup = new RoomBackup(MainActivityJava.this);
...
roomBackup.database(FruitDatabase.Companion.getInstance(getApplicationContext()));
roomBackup.enableLogDebug(enableLog);
roomBackup.backupIsEncrypted(encryptBackup);
roomBackup.backupLocation(RoomBackup.BACKUP_FILE_LOCATION_INTERNAL);
roomBackup.maxFileCount(5);
roomBackup.onCompleteListener((success, message, exitCode) -> {
Log.d(TAG, "success: " + success + ", message: " + message + ", exitCode: " + exitCode);
if (success) roomBackup.restartApp(new Intent(getApplicationContext(), MainActivityJava.class));
});
roomBackup.backup();
final RoomBackup roomBackup = new RoomBackup(MainActivityJava.this);
...
roomBackup.database(FruitDatabase.Companion.getInstance(getApplicationContext()));
roomBackup.enableLogDebug(enableLog);
roomBackup.backupIsEncrypted(encryptBackup);
roomBackup.backupLocation(RoomBackup.BACKUP_FILE_LOCATION_INTERNAL);
roomBackup.onCompleteListener((success, message, exitCode) -> {
Log.d(TAG, "success: " + success + ", message: " + message + ", exitCode: " + exitCode);
if (success) roomBackup.restartApp(new Intent(getApplicationCo
Selected from shared topics, language and repository description—not editorial ratings.
android10 /
This is a movies sample app in Kotlin, which is part of a serie of blog posts I have written about architecting android application using different approaches.
80/100 healthKotlin /
This is an open-source, mobile, cross-platform application built with Kotlin Multiplatform Mobile. It's a simple RSS reader, and you can download it from the App Store and Google Play. It's been designed to demonstrate how KMM can be used in real production projects.
91/100 healthRoomBackup.BACKUP_FILE_LOCATION_CUSTOM_DIALOGbackupLocationCustomFile(File) to set a custom FileRoomBackup.BACKUP_FILE_LOCATION_CUSTOM_FILEAttention
For custom dialog and custom file I only verified the functionality for local storage. For thirt party storage please try and contact me if it is not working. I hope I can find a solution and fix it :)
.backupLocation(RoomBackup.BACKUP_FILE_LOCATION_INTERNAL)
Set a custom File to save/restore to/from
Only working if backupLocation is set to BACKUP_FILE_LOCATION_CUSTOM_FILE
You have to define a File withe Filename and extension
.backupLocationCustomFile(backupLocationCustomFile: File)
Set a custom dialog title, when showing list of available backups to restore (only for external or internal storage)
.customRestoreDialogTitle("Choose file to restore")
Set your custom name to the Backup files
Attention
If a backup file with the same name already exists, it will be replaced
.customBackupFileName(*DatabaseName* + *currentTime* + ".sqlite3")
Run some code, after backup / restore process is finished
.onCompleteListener { success, message, exitCode ->
}
Restart your Application. Can be implemented in the onCompleteListener, when "success == true"
Attention
it does not always work reliably!
But you can use other methods.
Important is that all activities / fragments that are still open must be closed and reopened
Because the Database instance is a new one, and the old activities / fragments are trying to
work with the old instance
.restartApp(Intent(this@MainActivity, MainActivity::class.java))
mozilla-mobile /
⚠️ This project moved to a new repository. It is now developed and maintained at: https://github.com/mozilla-mobile/firefox-android
37/100 healthakshay2211 /
Pix is a Whatsapp image picker replica. with this, you can integrate an image picker just like WhatsApp.
90/100 healthsceneview /
Sceneform Maintained is an ARCore Android SDK with Google Filament as 3D engine. This is the continuation of the archived Sceneform
34/100 healthOneSignal /
OneSignal makes engaging customers simple and is the fastest, most reliable service to send push notifications, in-app messages, SMS, and emails. This plugin makes it easy to integrate your native Android or Amazon app with OneSignal. https://onesignal.com
70/100 health