Skip to content

gontrex/RealmExport

 
 

Repository files navigation

RealmExport

RealmExport is a Realm helper to export Realm Databases to:

  • Json
  • Json File

You can use this Json Object to send by email or for any other things that you need.

Only increase the size of your project by 10 KB ;)

Download

You can download an arr from maven releases page.

Or use Gradle:

repositories {
    maven { url 'https://github.com/softotalss/realmexport/raw/master/maven-repository' }
}
dependencies {
    implementation 'com.google.code.gson:gson:x.x.x'
    implementation 'com.github.softotalss:realm_export:1.1.0'
}

How do I use RealmExport?

You can use RealmExport in any part of your code, but it's recommended that you use it in a background task.

Simple use

// Export to Json:
JsonObject dbJson = RealmExport.init((new RealmConfiguration.Builder()).build()).toJson();  
// Export to Json File:
RealmExport.init((new RealmConfiguration.Builder()).build()).toJsonFile("path/bd.json");  

Not forget replace "(new RealmConfiguration.Builder()).build()" for your specific Realm Configuration

Advanced use

// You can use different initializations:
RealmExport.init(RealmConfiguration configuration, String nullValue, DateFormat dateTimeFormatter)
RealmExport.init(RealmConfiguration configuration, String nullValue)

Default values

// For nullValue: "[null]"
// For dateTimeFormatter: SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.LONG, SimpleDateFormat.LONG)

Deployment

  1. update version information
  2. gradlew assemble :real_export:publishMavenPublicationToMavenRepository
  3. git add, commit, push (on master branch)

Author

Alejandro Santana - @softotalss on GitHub

This project is based on stetho-realm

License

BSD, part MIT and Apache 2.0. See the LICENSE file for details.

About

Export Realm Databases to Json and Json File

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%