Code Monkey home page Code Monkey logo

mongodbmobile_starter's Introduction

alt text

MongoDb Mobile Android Starter

An Android starter project for working with MongoDB Mobile & Stitch.

At MongoDB World 2018, Mongo announced the beta of MongoDB Mobile, which enables you to use Mongo on your Android and iOS devices. This starter app provides a way to get up and running quickly (with zero config), and then either customize it or steal the code for your own projects.

Requirements

For a list of platforms supported by MongoDB Mobile, see the MongoDB Mobile docs.

Getting Started

  1. Clone or download this repo.

  2. Copy the MongoDB Mobile tarball from one of the following locations:

    Platform Link
    x86_64 https://s3.amazonaws.com/mciuploads/mongodb-mongo-v4.0/embedded-sdk/embedded-sdk-android-x86_64-latest.tgz
    arm64-v8a https://s3.amazonaws.com/mciuploads/mongodb-mongo-v4.0/embedded-sdk/embedded-sdk-android-arm64-latest.tgz
    armeabi-v7a https://s3.amazonaws.com/mciuploads/mongodb-mongo-v4.0/embedded-sdk/embedded-sdk-android-arm32-latest.tgz
  3. Extract the tarball, and then copy the contents of the /lib/ folder to /app/src/main/jniLibs/platform, where platform matches one of the 3 listed above. When finished, your directory structure should look similar to this:

    MongoDbMobile_Starter
    |-> app
       |-> src
          |-> main
             |-> jniLibs
                   |-> x86_64 (or arm64-v8a or armeabi-v7a)
                         |-> cmake
                         |-> pkgconfig
                         |-> libaccumulator.so
                         |-> etc.
    
  4. Open the project in Android Studio.

  5. Compile and run the project. The name of the database and collection have been pre-entered for you. Click Get Remote Data to fetch the data from Atlas. If sync data locally is checked, the data will be copied to the MongoDB Mobile database, too.

  6. The app will switch to the Remote tab and display the JSON data that was returned. If you chose to sync the data, you can swipe or select the local tab to see the local data.

Customize it!

This app is configured to use a test account with some simple data. When you are ready to customize the app and use your own data, follow these steps:

  1. Change the following values:

    a. In res/values/strings.xml, replace starterappdata-tqlwq with your Stitch App Id. Don't have a Stitch app yet? Cool -- It's free and easy to get started!

    b. Depending on the authentication provider(s) you want to use, change the appropriate values in strings.xml. For example, this app defaults to using an API Key. If you also want to use API Key auth, in your Stitch app, generate a new API KEY, and then replace the value in the userApiKey field.

    c. If you haven't done so, add data to your Atlas instance and create the Stitch rules to access that data. See https://docs.mongodb.com/stitch/procedures/integrate-mongo/ for more information.

    d. In MainActivity.java, on or near line 34, be sure to call the correct Auth method for your app if you are not using API Key Auth.

    e. In the config_screen.xml, remove or replace the text values for the database and collection EditText elements, but keep the hints.

  2. Compile and run the project.

Read More

MongoDB Mobile also works on iOS! See https://docs.mongodb.com/stitch/mongodb/mobile/mobile-overview/ to get started.

https://docs.mongodb.com/stitch/mongodb/mobile/build-mobile/

mongodbmobile_starter's People

Contributors

mongocaleb avatar

Watchers

 avatar

Forkers

chanyuxuan1993

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.