4
votes

I use PhoneGap and I would like to avoid starting/working with an Android Emulator but be simply in browser and work with Couchbase Lite as if I was on device.

I mean, I want to create/start a database, put some data there to see how it works, and then push/start it to/on device.

So, I would like to start Couchbase Lite locally on my laptop to make it receive http calls from my web app.

But since 'Lite' means 'embedded' to a device, there is a question: is it possible to launch it on my laptop but not on device or an emulator?

I understand that I could mock any http response that Couchbase Lite could provide me back on my ajax-requests but I don't know what it can and cannot do, so I need to work with real data for now.

For example if I had used SQL it would not be a problem, since I can install SQLite on Android as well as on Laptop. I may avoid using simulator, being on my browser on my Laptop.

And general question: what is the best practice how to work with Couchbase Lite on local machine to test all stuff instead of wasting time playing with emulator?

2
I highly recommend posting questions like this in the Couchbase Mobile google group rather than SO so that you can get direct conversation from the Couchbase mobile team :) - scalabl3
Ok. Got it. There are not yet many folks who use it, I guess. - ses
This is the first beta, so yeah it's pretty new :) - scalabl3

2 Answers

0
votes

This is a tricky one.

You can download Couchbase Lite Java which shares the same APIs as the native Android version, but since PhoneGap uses JavaScript, it is a completely different animal.

If you didn't want to test via the device, I would actually recommend just using mock data hardcoded within your application. This data would be what you expect out of Couchbase Lite, but of course staged. Then when you're sure you have the functionality in place, slip Couchbase Lite into the mix.

My personal opinion is that mobile apps were meant to be tested via mobile platforms (not web browser), but that is just me.

Best,

0
votes

You are kind of mixing apples and oranges here. SQL is a language standard with many implementations. Among those are SQLite on OSX and SQLite on Android, and, for instance MySQL, on Linux and Postgres on Windows.

Couchbase is an implementation of an open (but not a broad standard) NoSQL API. You interact with it using bindings for your particular implementation language, not by embedding the standard query language (SQL) in strings.

Couchbase goes to a lot of trouble to keep its language bindings similar from one language to another. That said, the whole point is that they are bindings for different languages. They are, inevitably, slightly different. The Android bindings depend on Context, the Android file system, Looper and so on. They cannot be used except in an Android environment.

That said, the bindings are just the icing on the cake. The underlying database engine is the same for all Couchbase-lite products. The code you use in your browser will not be portable. The databases you build, however, are portable and the general structure of the code you write should be very, very similar.