{"id":12936,"date":"2022-03-24T14:58:34","date_gmt":"2022-03-24T21:58:34","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=12936"},"modified":"2025-06-13T20:52:14","modified_gmt":"2025-06-14T03:52:14","slug":"building-a-mobile-application-with-couchbase-part-1","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/","title":{"rendered":"Build A Mobile Application With Couchbase &#8211; Part 1"},"content":{"rendered":"<p><span style=\"font-weight: 400\">This multipart blog will help you build an end-to-end mobile application using Couchbase Lite. State of the art end-to-end, scalable and production-grade applications include the following features:<\/span><\/p>\n<ol>\n<li style=\"list-style-type: none\">\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">An <strong>embedded database<\/strong> &#8211; storing data locally reduces network trips to a centralized database for every activity. This is crucial for improving the user experience.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\"><strong>Synchronization<\/strong> with other peer mobile devices and with a centralized server.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\"><strong>Advanced analytics<\/strong> capabilities, full-text search and machine learning on the device.<\/span><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p><span style=\"font-weight: 400\">Since there\u2019s a lot to cover, we\u2019ve split this project into three parts.\u00a0<\/span><b><\/b><b>Part 1 showcases the process for building a mobile application that leverages Couchbase Lite and uses it as an embedded database to store data. <\/b><b><\/b><span style=\"font-weight: 400\">Part 2 will show how to run Full Text Search (FTS) on the device. And p<\/span><span style=\"font-weight: 400\">art 3 will showcase the process of syncing the data with peers and a centralized Couchbase server.<\/span><\/p>\n<h4><b>What is Couchbase Mobile?\u00a0<\/b><\/h4>\n<p><a href=\"https:\/\/www.couchbase.com\/products\/mobile\/\"><span style=\"font-weight: 400\">Couchbase Mobile<\/span><\/a><span style=\"font-weight: 400\"> includes:<\/span><\/p>\n<ol>\n<li style=\"list-style-type: none\">\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Embedded <strong>Couchbase Lite<\/strong> database for edge devices<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">High-performance <strong>Sync Gateway<\/strong> for peer to peer and centralized server synchronization<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Edge data centers powered by <strong>Couchbase Server<\/strong> that can be deployed on the cloud, on-prem or in local edge data centers.<\/span><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_143557.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12937\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_143557.png\" alt=\"Couchbase Mobile architectural diagram\" width=\"965\" height=\"675\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143557.png 965w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143557-300x210.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143557-768x537.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143557-20x14.png 20w\" sizes=\"auto, (max-width: 965px) 100vw, 965px\" \/><\/a><\/p>\n<h4><b>Mobile application overview<\/b><\/h4>\n<p><span style=\"font-weight: 400\">The code for this demo application is in my <\/span><a href=\"https:\/\/github.com\/sandykris123\/couchbasemobile\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">Couchbase Mobile GitHub repository<\/span><\/a><span style=\"font-weight: 400\">.<\/span> <span style=\"font-weight: 400\">Download <\/span><i><span style=\"font-weight: 400\">Rateit.zip<\/span><\/i><span style=\"font-weight: 400\"> and extract the files to your local folder.\u00a0<\/span><span style=\"font-weight: 400\">Alternatively, you can follow the instructions in this blog to build the app from scratch.<\/span><\/p>\n<p><span style=\"font-weight: 400\">The app&#8217;s functionality is divided into three parts:<\/span><\/p>\n<ol>\n<li style=\"list-style-type: none\">\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Send rating requests<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Receive rating requests from others<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Viewing the rated request returned from others<\/span><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<h5><b>Send Rating Requests<\/b><\/h5>\n<p><span style=\"font-weight: 400\">The app that we will build in this application sends a rating request to a person and receives the rated request back.<\/span><\/p>\n<p><span style=\"font-weight: 400\">The <\/span><i><span style=\"font-weight: 400\">SEND TO<\/span><\/i><span style=\"font-weight: 400\"> field indicates the phone number of the person to whom you want to send the request. The <\/span><i><span style=\"font-weight: 400\">MESSAGE<\/span><\/i><span style=\"font-weight: 400\"> field indicates what you want them to do with it. In this case, since it is a rating request, I have a predefined message of &#8220;Rate 1-5&#8221;, indicating they need to supply a rating when they send the request back.<\/span><\/p>\n<p><span style=\"font-weight: 400\">The <\/span><i><span style=\"font-weight: 400\">SUBJECT<\/span><\/i><span style=\"font-weight: 400\"> field indicates any topic on which you want a rating, for example, like one of these:<\/span><\/p>\n<p style=\"padding-left: 40px\"><span style=\"font-weight: 400\">Actor: Chris Hemsworth<\/span><\/p>\n<p style=\"padding-left: 40px\"><span style=\"font-weight: 400\">Book: Pride and Prejudice<\/span><\/p>\n<p style=\"padding-left: 40px\"><span style=\"font-weight: 400\">www.google.com<\/span><\/p>\n<p><span style=\"font-weight: 400\">There are no strict edit validations on the fields, but that is something you would do when you build a production-grade mobile app.<\/span><\/p>\n<p><span style=\"font-weight: 400\">When you click <\/span><b>SEND<\/b><span style=\"font-weight: 400\">, a request is sent to the person you want a response from. Since we will be talking about syncing peer-to-peer with other devices, and with a centralized server in a future post, here we focus on the <\/span><b>local offline mode<\/b><span style=\"font-weight: 400\"> functionality.\u00a0<\/span><\/p>\n<h5><b>Received Rating Requests\u00a0<\/b><\/h5>\n<p><span style=\"font-weight: 400\">This section in the app lets you respond to rating requests received from others. We define a rating bar that lets you put in the number of stars for your rating.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">Just so I remain within the scope of this app when I send a request, I hardcoded values for <\/span><i><span style=\"font-weight: 400\">sender<\/span><\/i><span style=\"font-weight: 400\"> and <\/span><i><span style=\"font-weight: 400\">receiver<\/span><\/i><span style=\"font-weight: 400\">. I have used <\/span><i><span style=\"font-weight: 400\">Sandhya<\/span><\/i><span style=\"font-weight: 400\"> as the sender and <\/span><i><span style=\"font-weight: 400\">Rangana<\/span><\/i><span style=\"font-weight: 400\"> as the receiver. This section will display all the requests for <\/span><i><span style=\"font-weight: 400\">Rangana,<\/span><\/i><span style=\"font-weight: 400\"> i.e., where the <\/span><i><span style=\"font-weight: 400\">TO<\/span><\/i><span style=\"font-weight: 400\"> field is equal to <\/span><i><span style=\"font-weight: 400\">Rangana<\/span><\/i><span style=\"font-weight: 400\">.<\/span><\/p>\n<h5><b>Incoming Rated Requests<\/b><\/h5>\n<p><span style=\"font-weight: 400\">This section lists all the requests that you sent and received a rating back for.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Now let\u2019s walk through an example to make all the sections clear.<\/span><\/p>\n<p><span style=\"font-weight: 400\">First, we send a request to phone number 732-600-7000 with a message to rate the book Pride and Prejudice.<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_143657.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12938\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_143657.png\" alt=\"Sample screen of Couchbase Mobile app\" width=\"389\" height=\"666\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143657.png 389w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143657-175x300.png 175w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143657-300x514.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143657-12x20.png 12w\" sizes=\"auto, (max-width: 389px) 100vw, 389px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">When you click on <\/span><b>RECEIVED RATING REQUESTS<\/b><span style=\"font-weight: 400\"> it is actually showing me the ones that I sent to someone else, just for demo purposes here. In the real world, it would go to the actual person to whom this is addressed.<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_143738.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12939\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_143738.png\" alt=\"Receiving a messaging in the sample mobile app\" width=\"393\" height=\"641\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143738.png 393w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143738-184x300.png 184w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143738-300x489.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143738-12x20.png 12w\" sizes=\"auto, (max-width: 393px) 100vw, 393px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">I select a four-star rating and click on the<\/span><b> RATE<\/b><span style=\"font-weight: 400\"> button, which initiates returning it to the send (this rated request goes back to me as shown below):<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_143829.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12940\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_143829.png\" alt=\"\" width=\"404\" height=\"673\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143829.png 404w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143829-180x300.png 180w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143829-300x500.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143829-12x20.png 12w\" sizes=\"auto, (max-width: 404px) 100vw, 404px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">Now when clicking on <\/span><i><span style=\"font-weight: 400\">INCOMING RATED REQUESTS<\/span><\/i><span style=\"font-weight: 400\">, we can see if the rating made it back to me, the sender. You can see that it came back and listed my rating of 4.0 stars.<\/span><\/p>\n<p><span style=\"font-weight: 400\">The <\/span><i><span style=\"font-weight: 400\">DELETE<\/span><\/i><span style=\"font-weight: 400\"> button is available for you to remove that particular row now.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Now, let&#8217;s build the app!<\/span><\/p>\n<h4><b>Getting Started: Review CBLite Documentation<\/b><\/h4>\n<p><span style=\"font-weight: 400\">Please review the <\/span><a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/3.0\/android\/quickstart.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">documentation<\/span><\/a><span style=\"font-weight: 400\"> to understand the various components of a Couchbase Lite database application. For this app, I create a brand new database when the application is invoked for the first time. Alternatively, the app can also use a pre-built database.<\/span><\/p>\n<p><span style=\"font-weight: 400\">The steps to embed the database can be found here in the <\/span><a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/3.0\/android\/quickstart.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">Couchbase Lite documentation<\/span><\/a><span style=\"font-weight: 400\">. Review each of the sections to learn the following concepts:<\/span><\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">creating and opening a database<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">writing a document into the embedded database<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">writing queries to retrieve the document<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">expiring or deleting a document<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_143926.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-12941\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_143926-1024x581.png\" alt=\"Couchbase Mobile documentation\" width=\"900\" height=\"511\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143926-1024x581.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143926-300x170.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143926-768x436.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143926-20x11.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143926-1320x749.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_143926.png 1514w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<h4><b>App building prerequisites<\/b><\/h4>\n<p><span style=\"font-weight: 400\">This app has been built for Android devices using the following software and hardware prerequisites that you need to be aware of:<\/span><\/p>\n<ol>\n<li style=\"list-style-type: none\">\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">You need to understand the basics of building apps with Android Studio and programming in Java.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">This demo app and related screenshots come from building the app on a MacOS computer.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">We use the, freely available, <\/span><a href=\"https:\/\/developer.android.com\/studio\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">Android Studio 2020.3<\/span><\/a><span style=\"font-weight: 400\"> to build mobile apps for Android devices.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><b>Couchbase Lite version 3.0.0-beta02 is used.<\/b><span style=\"font-weight: 400\"> The required libraries will be embedded in the code and there is no need to download the software manually to your desktop.<\/span><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<h4><b>Building the application<\/b><\/h4>\n<p><span style=\"font-weight: 400\">Ensure that Android Studio is installed on your desktop and create a new project, choosing <\/span><b>Empty Activity<\/b><span style=\"font-weight: 400\"> as the project type. Android Studio builds a template of the main page for you based on what you pick. I chose this one because I want to build a customized app front page.<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_144020.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12942\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_144020.png\" alt=\"Starting an Android Studio project\" width=\"1008\" height=\"629\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144020.png 1008w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144020-300x187.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144020-768x479.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144020-20x12.png 20w\" sizes=\"auto, (max-width: 1008px) 100vw, 1008px\" \/><\/a><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_144114.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-12943\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_144114-1024x507.png\" alt=\"Android Studio project settings\" width=\"900\" height=\"446\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144114-1024x507.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144114-300x148.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144114-768x380.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144114-20x10.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144114.png 1031w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">You can see the different settings I used in the <\/span><i><span style=\"font-weight: 400\">New Project <\/span><\/i><span style=\"font-weight: 400\">form. This creates an app that will display \u201chello world\u201d when compiled and run on an emulator. In order to create an emulator for the app click on\u00a0 <\/span><b>Tools \u2192 AVD Manager \u2192 Create virtual Device<\/b><span style=\"font-weight: 400\">.<\/span><\/p>\n<p><span style=\"font-weight: 400\">This gives you a list of devices you can emulate without having to acquire the actual device and compile or deploy the code on it.\u00a0 I used <\/span><b>NEXUS 5X API 25<\/b><span style=\"font-weight: 400\">.<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_144200.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-12944\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_144200-1024x414.png\" alt=\"Choosing a virtual device for the Android Studio emulator\" width=\"900\" height=\"364\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144200-1024x414.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144200-300x121.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144200-768x310.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144200-1536x621.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144200-20x8.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144200-1320x534.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144200.png 1556w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">When you run the emulator the following screen shows the basic, empty, application:<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_144250.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12945\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_144250.png\" alt=\"Basic mobile app main window\" width=\"639\" height=\"882\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144250.png 639w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144250-217x300.png 217w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144250-300x414.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144250-14x20.png 14w\" sizes=\"auto, (max-width: 639px) 100vw, 639px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">From here we build the actual Rateit app components:<\/span><\/p>\n<p><span style=\"font-weight: 400\">Locate the <em>build.gradle(Module.App.rateit)<\/em> and modify the contents to match the following:<\/span><\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">The <em>compileSDK<\/em> and <em>minSDK<\/em> version for the emulator you choose.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">The Java version you have.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Add the following <em>implementation<\/em> line in the dependencies section:<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre class=\"\">implementation 'com.couchbase.lite:couchbase-lite-android:3.0.0-beta02'<\/pre>\n<h4><b>Layouts\u00a0<\/b><\/h4>\n<p><span style=\"font-weight: 400\">Layout files are XML files that describe the mobile application screen.<\/span> <span style=\"font-weight: 400\">The <\/span><i><span style=\"font-weight: 400\">activity_mail.xml<\/span><\/i><span style=\"font-weight: 400\"> file will be present in the project folder and needs to be replaced by the XML file from <\/span><a href=\"https:\/\/github.com\/sandykris123\/couchbasemobile\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">the GitHub code<\/span><\/a><span style=\"font-weight: 400\">. The rest of the XML files can be added by right-clicking on <\/span><b>layout \u2192 New \u2192 XML \u2192 Layout XML File<\/b><span style=\"font-weight: 400\">.<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_144401.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-12946\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_144401-1024x870.png\" alt=\"Adding new layouts to an Android Studio project\" width=\"900\" height=\"765\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144401-1024x870.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144401-300x255.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144401-768x653.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144401-20x17.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144401.png 1246w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">There are three more layout XML files to create:<\/span><\/p>\n<p><b>activity_main.xml\u00a0<\/b><\/p>\n<p><span style=\"font-weight: 400\">This has the<\/span> <i><span style=\"font-weight: 400\">SEND TO<\/span><\/i><span style=\"font-weight: 400\">, <\/span><i><span style=\"font-weight: 400\">MESSAGE<\/span><\/i><span style=\"font-weight: 400\">,<\/span> <i><span style=\"font-weight: 400\">SUBJECT<\/span><\/i> <span style=\"font-weight: 400\">fields<\/span> <span style=\"font-weight: 400\">in addition to the<\/span> <span style=\"font-weight: 400\">two list views for the <\/span><i><span style=\"font-weight: 400\">Sent<\/span><\/i><span style=\"font-weight: 400\"> and <\/span><i><span style=\"font-weight: 400\">Received<\/span><\/i><span style=\"font-weight: 400\"> requests. It also defines which function to invoke when the <\/span><b>CLICK TO SEND RATING REQUEST<\/b><span style=\"font-weight: 400\">, <\/span><b>RECEIVED RATING REQUESTS<\/b><span style=\"font-weight: 400\"> and <\/span><b>INCOMING RATING REQUESTS<\/b><span style=\"font-weight: 400\"> buttons are pressed. The XML code can be written or it can be generated by setting the attributes in the <\/span><i><span style=\"font-weight: 400\">attributes<\/span><\/i><span style=\"font-weight: 400\"> section of the designer.<\/span><\/p>\n<p><b>CustomLayout.xml\u00a0<\/b><\/p>\n<p><span style=\"font-weight: 400\">This has the <\/span><i><span style=\"font-weight: 400\">Listview<\/span><\/i><span style=\"font-weight: 400\"> and the layout for all the <\/span><b>RECEIVED RATING REQUESTS<\/b><span style=\"font-weight: 400\"> and defines which function to invoke when the <\/span><b>Rate<\/b><span style=\"font-weight: 400\"> and <\/span><b>Delete<\/b><span style=\"font-weight: 400\"> buttons are pressed.\u00a0<\/span><\/p>\n<p><b>CustomLayoutRated.xml<\/b><span style=\"font-weight: 400\">\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">This layout has the <\/span><i><span style=\"font-weight: 400\">Listview<\/span><\/i><span style=\"font-weight: 400\"> and the layout for all the <\/span><b>INCOMING RATED REQUESTS<\/b><span style=\"font-weight: 400\"> and also defines which function to invoke when the <\/span><b>Delete<\/b><span style=\"font-weight: 400\"> button is pressed.<\/span><\/p>\n<h4><b>The Rateit App<\/b><\/h4>\n<p><span style=\"font-weight: 400\">The main page of the app has three buttons:<\/span><\/p>\n<ol>\n<li style=\"list-style-type: none\">\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">CLICK TO SEND RATING REQUEST<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">RECEIVED RATING REQUESTS<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">INCOMING RATING REQUESTS<\/span><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p><span style=\"font-weight: 400\">The <\/span><i><span style=\"font-weight: 400\">mainactivity.java<\/span><\/i><span style=\"font-weight: 400\"> file will be present in the project folder and needs to be replaced by the code from <\/span><a href=\"https:\/\/github.com\/sandykris123\/couchbasemobile\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">the GitHub repository<\/span><\/a><span style=\"font-weight: 400\">. The rest of the Java files can be added by clicking on <\/span><b>Java<\/b><span style=\"font-weight: 400\">, highlighting <\/span><b>com.example.rateit<\/b><span style=\"font-weight: 400\"> and right-clicking on <\/span><b>New \u2192 Java Class<\/b><span style=\"font-weight: 400\">. Create classes for each of:<\/span><\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">User.java<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">UserCustomAdapter.java<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Rated.java<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">RatedCustomAdapter.java<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_144450.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-12947\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_144450-1024x873.png\" alt=\"Adding new Java classes to an Android Studio project\" width=\"900\" height=\"767\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144450-1024x873.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144450-300x256.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144450-768x655.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144450-20x17.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144450.png 1245w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<h4><b>Reviewing the code\u00a0<\/b><\/h4>\n<h5><b>Mainactivity.java<\/b><\/h5>\n<p><span style=\"font-weight: 400\">Locate <\/span><i><span style=\"font-weight: 400\">Mainactivity.java<\/span><\/i><span style=\"font-weight: 400\"> under the <\/span><b>Java \u2192 com.example.rateit<\/b><span style=\"font-weight: 400\"> folder and paste the following code inside the class <\/span><i><span style=\"font-weight: 400\">MainAcivity<\/span><\/i><span style=\"font-weight: 400\">.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">The <\/span><i><span style=\"font-weight: 400\">senddata<\/span><\/i><span style=\"font-weight: 400\"> function gets activated when <\/span><b>CLICK TO SEND RATING REQUEST<\/b><span style=\"font-weight: 400\"> is clicked. It collects all the input fields and creates two documents\u2014one of Type <\/span><i><span style=\"font-weight: 400\">Send<\/span><\/i><span style=\"font-weight: 400\"> and one of type <\/span><i><span style=\"font-weight: 400\">Received<\/span><\/i><span style=\"font-weight: 400\">. The received record type helps us see records in the <\/span><i><span style=\"font-weight: 400\">RECEIVED RATING REQUESTS<\/span><\/i><span style=\"font-weight: 400\">.\u00a0<\/span><\/p>\n<p><em><span style=\"font-weight: 400\">Note that Part 2 of the blog series will show the peer-to-peer sync feature and the writing of the received record will be removed because the second device will be receiving this request.<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400\">The <\/span><i><span style=\"font-weight: 400\">receivedata<\/span><\/i><span style=\"font-weight: 400\"> function gets activated when <\/span><b>RECEIVED RATING REQUESTS<\/b><span style=\"font-weight: 400\"> is clicked and it displays all the rating requests received. It executes a query against the local database to get the records. It lets you put in a rating and creates a JSON record with the rating when the <\/span><b>RATE<\/b><span style=\"font-weight: 400\"> button is clicked, writing the request back to the database with a document type of <\/span><i><span style=\"font-weight: 400\">rated<\/span><\/i><span style=\"font-weight: 400\">. If the <\/span><b>DELETE<\/b><span style=\"font-weight: 400\"> button is clicked, the record is deleted but setting the <a href=\"https:\/\/www.couchbase.com\/blog\/how-to-manage-ttl-with-couchbase-n1ql\/\">TTL<\/a> (Time to Live) of the document to expire.<\/span><\/p>\n<p><span style=\"font-weight: 400\">The <\/span><i><span style=\"font-weight: 400\">incomingratings<\/span><\/i><span style=\"font-weight: 400\"> function gets activated when the <\/span><b>INCOMING RATING REQUESTS<\/b><span style=\"font-weight: 400\"> button is clicked and it displays all the ratings sent by the user that were rated by others and came back. When the <\/span><b>DELETE<\/b><span style=\"font-weight: 400\"> button is pressed the TTL (Time to Live) attribute is set to expire.<\/span><\/p>\n<p><b>Rated.Java<\/b><span style=\"font-weight: 400\"> holds the <\/span><i><span style=\"font-weight: 400\">Rated<\/span><\/i><span style=\"font-weight: 400\"> class and sets and gets the various attributes of the records\u00a0<\/span><\/p>\n<p><b>RatedCustomAdapter.java<\/b><span style=\"font-weight: 400\"> and <\/span><b>RatedHolder.java<\/b><span style=\"font-weight: 400\"> will populate the listview. The layout is defined in <\/span><i><span style=\"font-weight: 400\">CustomLayoutRated.xml<\/span><\/i><\/p>\n<p><b>User.java<\/b><span style=\"font-weight: 400\"> has the get and set functions for document attributes required to populate the <\/span><b>RECEIVED RATING REQUEST<\/b><span style=\"font-weight: 400\"> listview.<\/span><\/p>\n<p><b>UserCustomAdapter.java<\/b><span style=\"font-weight: 400\"> and <\/span><b>UserHolder.java<\/b><span style=\"font-weight: 400\"> has the <\/span><b>RECEIVED RATING REQUEST<\/b><span style=\"font-weight: 400\"> listview including the <\/span><i><span style=\"font-weight: 400\">Rating Bar<\/span><\/i><span style=\"font-weight: 400\">, the contents of the record and the <\/span><b>RATE<\/b><span style=\"font-weight: 400\"> and <\/span><b>DELETE<\/b><span style=\"font-weight: 400\"> button<\/span><\/p>\n<p><span style=\"font-weight: 400\">Once all these pieces of code are placed in the appropriate folders and files in the app, the project folder will look like this:<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_144603.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-12948\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_144603-691x1024.png\" alt=\"File structure of Android Studio project\" width=\"691\" height=\"1024\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144603-691x1024.png 691w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144603-203x300.png 203w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144603-768x1138.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144603-300x444.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144603-14x20.png 14w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144603.png 796w\" sizes=\"auto, (max-width: 691px) 100vw, 691px\" \/><\/a><\/p>\n<h4><b>Compiling the code\u00a0<\/b><\/h4>\n<p><span style=\"font-weight: 400\">Once all the code has been updated, click on <\/span><b>Build \u2192 ReBuild Project<\/b><span style=\"font-weight: 400\">. Once it succeeds click on <\/span><b>Build \u2192 Run<\/b><span style=\"font-weight: 400\">.<\/span><\/p>\n<p><span style=\"font-weight: 400\">You will be asked to choose the emulator the first time you run the app, e.g., choose the <\/span><i><span style=\"font-weight: 400\">NEXUS 5X API 25<\/span><\/i><span style=\"font-weight: 400\"> like I did. Once the run is complete the main page will look like this:<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_144653.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-12949\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/03\/image_2022-03-24_144653-602x1024.png\" alt=\"Final main screen of Android Studio app running Couchbase Mobile\" width=\"602\" height=\"1024\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144653-602x1024.png 602w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144653-176x300.png 176w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144653-300x510.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144653-12x20.png 12w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/image_2022-03-24_144653.png 607w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">You have now successfully deployed the code into the emulator of your choice.<\/span><\/p>\n<h2><b>Next steps<\/b><\/h2>\n<p><span style=\"font-weight: 400\">This is the first part of the blog series, <\/span><b>Building a Mobile Application with Couchbase<\/b><span style=\"font-weight: 400\">, which focuses on a complete end-to-end mobile solution. This post showed how to build an offline mobile app with a local, embedded, Couchbase Lite database.<\/span><\/p>\n<p><span style=\"font-weight: 400\">In the next part of the series, we will build with the Sync Gateway feature to showcase the peer-to-peer sync feature as well as syncing with a centralized Couchbase Server cluster.<\/span><\/p>\n<p><span style=\"font-weight: 400\">The main resources referenced in this post included:<\/span><\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li style=\"font-weight: 400\"><a href=\"https:\/\/github.com\/sandykris123\/couchbasemobile\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">GitHub repository &#8211; including Rateit app project code<\/span><\/a><\/li>\n<li style=\"font-weight: 400\"><a href=\"https:\/\/www.couchbase.com\/products\/mobile\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">Couchbase Mobile &#8211; product information<\/span><\/a><\/li>\n<li style=\"font-weight: 400\"><a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/3.0\/android\/quickstart.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">Couchbase Lite documentation<\/span><\/a><\/li>\n<li style=\"font-weight: 400\"><a href=\"https:\/\/developer.android.com\/studio\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">Android Studio<\/span><\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This multipart blog will help you build an end-to-end mobile application using Couchbase Lite. State of the art end-to-end, scalable and production-grade applications include the following features: An embedded database &#8211; storing data locally reduces network trips to a centralized [&hellip;]<\/p>\n","protected":false},"author":66,"featured_media":12950,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[2370,7667,1810],"tags":[1968],"ppma_author":[9038],"class_list":["post-12936","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","category-couchbase-lite","category-couchbase-mobile","tag-embedded-database"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.8 (Yoast SEO v25.8) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Build A Mobile Application With Couchbase - Part 1 - The Couchbase Blog<\/title>\n<meta name=\"description\" content=\"Build a Java-based mobile app using a Couchbase Lite embedded NoSQL database with Android Studio, part one in the series.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Build A Mobile Application With Couchbase - Part 1\" \/>\n<meta property=\"og:description\" content=\"Build a Java-based mobile app using a Couchbase Lite embedded NoSQL database with Android Studio, part one in the series.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-03-24T21:58:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T03:52:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/shutterstock_1073312792-scaled.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t<meta property=\"og:image:height\" content=\"1440\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sandhya Krishnamurthy, Senior Solutions Engineer, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sandhya Krishnamurthy, Senior Solutions Engineer, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/\"},\"author\":{\"name\":\"Sandhya Krishnamurthy, Senior Solutions Engineer, Couchbase\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/2d421ebd7ebf63e5491a9371909ab723\"},\"headline\":\"Build A Mobile Application With Couchbase &#8211; Part 1\",\"datePublished\":\"2022-03-24T21:58:34+00:00\",\"dateModified\":\"2025-06-14T03:52:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/\"},\"wordCount\":1869,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/shutterstock_1073312792-scaled.jpg\",\"keywords\":[\"embedded database\"],\"articleSection\":[\"Android\",\"Couchbase Lite\",\"Couchbase Mobile\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/\",\"name\":\"Build A Mobile Application With Couchbase - Part 1 - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/shutterstock_1073312792-scaled.jpg\",\"datePublished\":\"2022-03-24T21:58:34+00:00\",\"dateModified\":\"2025-06-14T03:52:14+00:00\",\"description\":\"Build a Java-based mobile app using a Couchbase Lite embedded NoSQL database with Android Studio, part one in the series.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/shutterstock_1073312792-scaled.jpg\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/shutterstock_1073312792-scaled.jpg\",\"width\":2560,\"height\":1440},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Build A Mobile Application With Couchbase &#8211; Part 1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/2d421ebd7ebf63e5491a9371909ab723\",\"name\":\"Sandhya Krishnamurthy, Senior Solutions Engineer, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/f4d7b0d0e3660d30cbd035db5621088e\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b2f1ee16accb4f849269e443ba5b34bc512dd5d425b4399779ebbaf3d1154557?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b2f1ee16accb4f849269e443ba5b34bc512dd5d425b4399779ebbaf3d1154557?s=96&d=mm&r=g\",\"caption\":\"Sandhya Krishnamurthy, Senior Solutions Engineer, Couchbase\"},\"description\":\"Sandhya Krishnamurthy is a technologist with a strong database development background and pre-sales experience. She is a part-time artist, part-time singer and full-time mom.\",\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/sandhya-krishnamurthy\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Build A Mobile Application With Couchbase - Part 1 - The Couchbase Blog","description":"Build a Java-based mobile app using a Couchbase Lite embedded NoSQL database with Android Studio, part one in the series.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/","og_locale":"en_US","og_type":"article","og_title":"Build A Mobile Application With Couchbase - Part 1","og_description":"Build a Java-based mobile app using a Couchbase Lite embedded NoSQL database with Android Studio, part one in the series.","og_url":"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/","og_site_name":"The Couchbase Blog","article_published_time":"2022-03-24T21:58:34+00:00","article_modified_time":"2025-06-14T03:52:14+00:00","og_image":[{"width":2560,"height":1440,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/shutterstock_1073312792-scaled.jpg","type":"image\/jpeg"}],"author":"Sandhya Krishnamurthy, Senior Solutions Engineer, Couchbase","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Sandhya Krishnamurthy, Senior Solutions Engineer, Couchbase","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/"},"author":{"name":"Sandhya Krishnamurthy, Senior Solutions Engineer, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/2d421ebd7ebf63e5491a9371909ab723"},"headline":"Build A Mobile Application With Couchbase &#8211; Part 1","datePublished":"2022-03-24T21:58:34+00:00","dateModified":"2025-06-14T03:52:14+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/"},"wordCount":1869,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/shutterstock_1073312792-scaled.jpg","keywords":["embedded database"],"articleSection":["Android","Couchbase Lite","Couchbase Mobile"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/","url":"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/","name":"Build A Mobile Application With Couchbase - Part 1 - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/shutterstock_1073312792-scaled.jpg","datePublished":"2022-03-24T21:58:34+00:00","dateModified":"2025-06-14T03:52:14+00:00","description":"Build a Java-based mobile app using a Couchbase Lite embedded NoSQL database with Android Studio, part one in the series.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/shutterstock_1073312792-scaled.jpg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/03\/shutterstock_1073312792-scaled.jpg","width":2560,"height":1440},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/building-a-mobile-application-with-couchbase-part-1\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Build A Mobile Application With Couchbase &#8211; Part 1"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/2d421ebd7ebf63e5491a9371909ab723","name":"Sandhya Krishnamurthy, Senior Solutions Engineer, Couchbase","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/f4d7b0d0e3660d30cbd035db5621088e","url":"https:\/\/secure.gravatar.com\/avatar\/b2f1ee16accb4f849269e443ba5b34bc512dd5d425b4399779ebbaf3d1154557?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b2f1ee16accb4f849269e443ba5b34bc512dd5d425b4399779ebbaf3d1154557?s=96&d=mm&r=g","caption":"Sandhya Krishnamurthy, Senior Solutions Engineer, Couchbase"},"description":"Sandhya Krishnamurthy is a technologist with a strong database development background and pre-sales experience. She is a part-time artist, part-time singer and full-time mom.","url":"https:\/\/www.couchbase.com\/blog\/author\/sandhya-krishnamurthy\/"}]}},"authors":[{"term_id":9038,"user_id":66,"is_guest":0,"slug":"sandhya-krishnamurthy","display_name":"Sandhya Krishnamurthy, Senior Solutions Engineer, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/b155c5b9bb4bc33f88ee8b7a387044ccc4e23146d3058e66ea7c3a82dd1f51c0?s=96&d=mm&r=g","author_category":"","last_name":"Krishnamurthy","first_name":"Sandhya","job_title":"","user_url":"","description":"Sandhya Krishnamurthy is a technologist with a strong database development background and pre-sales experience. She is a part-time artist, part-time singer and full-time mom."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/12936","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/66"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=12936"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/12936\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/12950"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=12936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=12936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=12936"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=12936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}