Couchbase Lite is an embedded NoSQL database for iOS, Android and .Net platforms. The framework’s API supports native platform bindings for Android(Java), iOS (Swift, ObjC) and UWP/Xamarin (csharp). This implies that if you are building a Cordova app and you want to use Couchbase Lite as your embedded data persistence layer, you will have to find a way to access Couchbase Lite’s native APIs from within your Cordova web application. You can accomplish that with Cordova Plugins. Cordova plugins allow web-based apps running in a Cordova webview to access native platform functionality through a Javascript interface.

Arquitetura

At a high level, the architecture of a Cordova application that uses Cordova Plugins to access native code libraries is pretty straightforward.
– The UI layer or the web app layer is written using HTML/Javascript and is common across mobile platforms.
– The WebView is used for rendering the web app
– The web app uses plugins to access native functionality. The Couchbase Lite Cordova Plugin is written in native platform language and is responsible for interfacing with Couchbase Lite. The plugin exposes a JS API that is accessible to the web app.

Tutorial

We have put together two tutorials, one for Android and one for iOS. Each tutorial will walk you through the steps on how you can build a Cordova plugin that will interface with Couchbase Lite 2.x on specific platform. This Couchbase Lite plugin will allow Cordova applications to use Couchbase Lite for data persistence. In our sample app, we will use Ionic for building our the frontend web app layer.

We will be working with a very simple app called the “Hotel-Lister”. This app allows users to
– Query for and to display a list of hotels.

The hotels are queried for from a local pre-built Couchbase Lite database and displayed in the Ionic web app.

So let’s get started! If you are developing for iOS, you can get started with the iOS tutorial) and if you are developing for Android, follow the instructions in the Android tutorial).

Próximas etapas

After completing the tutorial, you should have a good idea of how to use Couchbase Lite as a local data store within your Cordova Application on iOS and Android. Check out our tutorials site for more sample apps.

Se tiver dúvidas ou comentários, deixe um comentário abaixo ou entre em contato comigo pelo Twitter @rajagp ou envie-me um e-mail para priya.rajagopal@couchbase.com. O Fóruns do Couchbase são outro bom lugar para entrar em contato com perguntas.

Agradecimentos

I would like to thank James Nocentini for his contributions to the tutorials and development of the sample apps.

 

Autor

A ordem da postagem em relação a outras postagens. Priya Rajagopal, Diretora Sênior, Gerenciamento de Produtos

Priya Rajagopal é diretora sênior de gerenciamento de produtos da Couchbase, responsável pelas plataformas de desenvolvedor para a nuvem e a borda. Ela desenvolve software profissionalmente há mais de 20 anos em vários cargos técnicos e de liderança de produtos, com mais de 10 anos de foco em tecnologias móveis. Como delegada de padrões de IPTV da TISPAN, ela foi uma das principais colaboradoras das especificações de padrões de IPTV. Ela tem 22 patentes nas áreas de rede e segurança de plataforma.

Posição vertical a partir do topo para iniciar o corte como uma porcentagem da altura da imagem.