RoomBackup

class RoomBackup(var context: Context)

MIT License

Copyright (c) 2024 Raphael Ebner

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Constructors

Link copied to clipboard
constructor(context: Context)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun backup()

Start Backup process, and set onComplete Listener to success, if no error occurred, else onComplete Listener success is false and error message is passed

Link copied to clipboard
fun backupIsEncrypted(backupIsEncrypted: Boolean): RoomBackup

Set file encryption to true / false can be used for backup and restore

Link copied to clipboard
fun backupLocationCustomFile(backupLocationCustomFile: File): RoomBackup

Set a custom file where to save or restore a backup. can be used for backup and restore

Link copied to clipboard
fun customBackupFileName(customBackupFileName: String): RoomBackup

Set custom Backup File Name, default = "$dbName-$currentTime.sqlite3"

Link copied to clipboard
fun customEncryptPassword(encryptPassword: String): RoomBackup

Set custom backup encryption password

Link copied to clipboard
fun customLogTag(customLogTag: String): RoomBackup

Set custom log tag, for detailed debugging

Link copied to clipboard
fun customRestoreDialogTitle(customRestoreDialogTitle: String): RoomBackup

Set custom Restore Dialog Title, default = "Choose file to restore"

Link copied to clipboard
fun database(roomDatabase: RoomDatabase): RoomBackup

Set RoomDatabase instance

Link copied to clipboard
fun enableLogDebug(enableLogDebug: Boolean): RoomBackup

Set LogDebug enabled / disabled

Link copied to clipboard
fun maxFileCount(maxFileCount: Int): RoomBackup

Set max backup files count if fileCount is maxFileCount the oldest backup file will be deleted is for both internal and external storage

Link copied to clipboard
fun onCompleteListener(listener: (success: Boolean, message: String, exitCode: Int) -> Unit): RoomBackup

Set onCompleteListener, to run code when tasks completed

Link copied to clipboard
fun restartApp(restartIntent: Intent): RoomBackup

Set Intent in which to boot after App restart

Link copied to clipboard
fun restore()

Start Restore process, and set onComplete Listener to success, if no error occurred, else onComplete Listener success is false and error message is passed