How to export realm database backup file in android?
I
Hi @koz01
Not sure what you are asking? A Realm database is just a file you can backup any way you want. You can use RealmConfiguration.getPath() to get the actual location of the file.
@koz01 Can https://medium.com/glucosio-project/example-class-to-export-import-a-realm-database-on-android-c429ade2b4ed#.kogne3ocy help you?
@kneth That is just our workaround and its not ideal even for Glucosio as a project for instance its difficult for us to be able to offer export to XLS or PDF or even import CSV or XLS (We cannot currently import anything except .realm files into our app)
Other mobile db's officially offer this support and so do server side db's so unsure why this is not a priority.
@cmelchior ^
Import support exists for swift but for java there is a feature parity gap in Realm http://stackoverflow.com/questions/34362618/import-data-to-realm-database
@bkerensa Yes, we do want to add support for importing/exporting data but currently we are prioritising other features. In general we try to fix the issues that doesn't have work-arounds first, and it should be entirely possible to import/export data from CSV using our existing API's.
I'm closing the issue. Importing and exporting data are nice features, and we currently track them in #2880.
Whenever I want to analyse a realm file, and I copy the realm file + realm.lock file, to the device, I get an Invalid format of Realm file exception? Any ideas how I can look at the realm file, on a device?
You shouldn't copy the lock file, just the realm file.
Are you using https://realm.io/docs/java/latest/api/io/realm/Realm.html#writeCopyTo-java.io.File-?
I'm copying the files onto the device, using adb push If there is an old lock file, on the device, should I delete it ( if I'm not going to adb push a lock file onto the device, but, I am going to push the realm file)?
The lock file is there for controlling concurrent access to the Realm file when it is opened, but it also tied to the particular architecture, .e.g you cannot use a lock file from 64 bit system on a 32 bit system.
I believe you don't have to delete it even if you override the Realm file, but doing so will definitely not hurt.
ok, thanks, then the issue must be with something else, since, without the lock file, I'm still getting the same error (Invalid format of Realm file).
@JohnnyTwoShoes Can you verify that the file has not been truncated (just check the size with adb shell ls -l)? Is the file encrypted? If so, does the key match?
Hi Guys.
I'm using this bash file.
https://gist.github.com/mMarcos208/033e56a4cc0f5f256ef64359598ab904