Install/Execute on Phonegap Couchbase Lite a .cblite format file on the app running

Hello !

I want to know if is possible how I can install or execute in my phonegap app a .cblite database file from the file system or a downloaded cblite file.

I actually know that is possible on native Android but I did not have founded any method or function that can do that o Cblite for phonegap

This can only be done using the native API. You’d probably need to get the source code of the CBL PhoneGap plugin, add a couple of lines of code to tell CBL to install the database file from your app package, and then rebuild the plugin.

Thanks a lot Jens ! I will take a look at it !, if i do a work around I will share it with te community.

Bests

Could he overwrite the local database file pushing it into the corresponding directory path? For example in Android he could the /data/data/app_pakacke/files/couch_db.cblite for his own prebuilt .cblite file

Yes, but that would require Java/native code to do. And if you’re doing that, it’s better to call our API to copy the db since it knows where to put it.

Hi Jens,

Any workround or sample for this? I followed http://developer.couchbase.com/documentation/mobile/current/develop/guides/couchbase-lite/native-api/database/index.html, and .cblite file and attachment folder are copied into the right folder, but the data is NOT loaded.

Please provide more details. Also, what OS?

The project is cordova couchbase lite based, similar to couchbase sample of todolite project. Ideally install pre built cblite for both ios and android, but currently we have been working on it for IOS

And what are the details of “data is NOT loaded”?

Based on http://developer.couchbase.com/documentation/mobile/current/develop/guides/couchbase-lite/native-api/database/index.html, there is a workround for todolite sample, is there code for installing prebuilt cblite for this on iOS?

If you want help you really need to give details of what is going wrong and what you need. Just pointing at our docs for the Database class doesn’t tell me anything. I don’t know what you mean about a workaround for ToDoLite (a workaround for what?)

I’m not a support engineer, I work on developing Couchbase Lite. I think good support is important and I try to spend time here answering questions, but the questions have to be clear and understandable.

1 Like