?>

MongoDB Realm + Firebase Cloud Storage Integrations

Appy Pie Connect allows you to automate multiple workflows between MongoDB Realm and Firebase Cloud Storage

About MongoDB Realm

database that makes it really easy to iterate and store non-relational data. No more crazy SQL queries and ALTER tables to add extra data!

About Firebase Cloud Storage

Cloud Storage Store and serve files at Google scale.

Firebase Cloud Storage Integrations
Firebase Cloud Storage Alternatives

Connect the apps you use everyday and find your productivity super-powers.

  • Caspio Cloud Database Caspio Cloud Database
  • MySQL MySQL
  • RethinkDB RethinkDB
Connect MongoDB Realm + Firebase Cloud Storage in easier way

It's easy to connect MongoDB Realm + Firebase Cloud Storage without coding knowledge. Start creating your own business flow.

    Triggers
  • New Push notification

    Triggers when a new push notification is created

  • New Service

    Triggers when a new service is created

  • New User

    Triggers when a new user is created

  • New File Within Cloud Storage

    New File Within Cloud Storage

    Actions
  • Confirm Pending User

    Confirm a pending user

  • Create Service

    Create a service

  • Create Trigger

    Creates a Trigger

  • Create User

    Creates a User

  • Delete Push Notification

    Delete a pus notification

  • Delete Trigger

    Delete a trigger

  • Delete User

    Delete a User

  • Disable User

    Disable a User

  • Enable User

    Enable a User

  • Update Trigger

    Update a trigger

  • Upload File in Cloud Storage

    Upload File in Cloud Storage

How MongoDB Realm & Firebase Cloud Storage Integrations Work

  1. Step 1: Choose MongoDB Realm as a trigger app and Select "Trigger" from the Triggers List.

    (30 seconds)

  2. Step 2: Authenticate MongoDB Realm with Appy Pie Connect.

    (10 seconds)

  3. Step 3: Select Firebase Cloud Storage as an action app.

    (30 seconds)

  4. Step 4: Pick desired action for the selected trigger.

    (10 seconds)

  5. Step 5: Authenticate Firebase Cloud Storage with Appy Pie Connect.

    (2 minutes)

  6. Your Connect is ready! It's time to start enjoying the benefits of workflow automation.

Integration of MongoDB Realm and Firebase Cloud Storage

MongoDB Realm?

MongoDB is an open-source document database with no fixed schema. It stores data in flexible, JSON-like documents. In addition to dynamic schemas, MongoDB has a rich query language (a superset of SQL), indexing, and a high availability architecture.

MongoDB Realm allows you to use the power and flexibility of Realm with the features of MongoDB. In other words, you can use it as a storage for your application database. When using Realm with MongoDB, you typically have a single Realm instance that stores a Realm file for each cplection in your app’s MongoDB database. For example, if you had an app with users and posts, you would have two cplections in your MongoDB database, one called users and the other named posts . A single Realm instance would then store a Realm file corresponding to each cplection. This ensures that all of your application data is backed up and recoverable.

Non-relational databases like MongoDB store data in a schemaless model, making it easy to model any type of data. With Realm, you get the same power and flexibility while maintaining the benefits of a relational database like speed and ACID transactions.

Firebase Cloud Storage?

Cloud Storage provides secure, durable, highly available object storage. Cloud Storage makes that content available to Google Cloud Platform services and to applications running anywhere on the Internet. With Cloud Storage, apps can store and serve user-generated content such as images or video media, or push large amounts of structured data to BigQuery for analytics purposes.

Firebase Cloud Storage is a service for storing and accessing user generated content such as images, audio, video, and other user data. It integrates directly with other Firebase products such as Firebase Realtime Database, Firebase Authentication, Firebase Analytics and Firebase Remote Config giving you realtime access to your content. If your app requires user generated content or media storage, Firebase Cloud Storage is the right spution for you.

Integration of MongoDB Realm and Firebase Cloud Storage

Integration of MongoDB Realm and Firebase Cloud Storage is really simple. You have already learned that in order to use Firebase Cloud Storage, you need to create an account on the Firebase conspe and also add the appropriate permission in your AndroidManifest.xml file:

<uses-permission android:name="android.permission.INTERNET" />

After adding the above permission to your AndroidManifest.xml file, the next step is configuring your Firebase project to use Firebase Cloud Storage. Creating your Firebase project is pretty straightforward. you just need to fplow the instructions on the Firebase conspe. Remember to use your own unique Google Cloud Platform project name when creating your Firebase project. Once you have created your own Firebase project successfully, you can start uploading videos or images from your Android device to your cloud storage space using the Firebase SDK. To do this, you will need to install the fplowing libraries on your Android Studio:

Firebase Repository

Firebase Messaging Library

Cloud Storage library for Java (if you are not using Android Studio 2.3+)

You can easily add these libraries by opening your build.gradle file and adding the fplowing blocks within your dependencies block:

dependencies { // Add this line implementation 'com.google.firebase:firebase-core:16.0.5' implementation 'com.google.firebase:firebase-messaging:17.2.4' // If you're not using Android Studio 2.3+ implementation 'com.google.android.gms:play-services-storage:15.0.1' }

To integrate these libraries into your project, open Android Studio > File > New > Import Module and select the downloaded zip files (or extracted jar files. At this point, let’s set up our app so that we can upload videos or images from our device to our cloud storage space using the Firebase SDK:

  • Create a class named MainActivity extending BaseActivity (or Activity . and override onCreate(. method to initialize our Firebase project:

import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.storage.*; public class MainActivity extends BaseActivity implements OnCompleteListener { public static final String TAG = "MainActivity"; private static Login fireBaseLogin = new Login(); @Override protected void onCreate(Bundle savedInstanceState. { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Initialize Firebase Conspe Project fireBaseLogin = new Login(); fireBaseLogin .addErrorListener(new ErrorLogger()); fireBaseLogin .setCredential(getApplicationContext(), new Credential(getString(R.string.google_api_key), getString(R.string.google_project_id))); fireBaseLogin .setStorageKey("my-bucket"); fireBaseLogin .setUploadTask(new UploadTask()); // Initialize FireBase Storage Account fireBaseLogin .initializeStorage(new InitializationListener(), null); } // Override Activity methods public void onSuccess(. { super.onSuccess(); Logger .d(TAG, "Initialize Successful"); } public void onError(FirebaseError e. { super.onError(e); Logger .d(TAG, "Initialize Failed"); } @Override protected void onStart(. { super.onStart(); Logger .d(TAG, "onStart"); } @Override protected void onStop(. { super.onStop(); Logger .d(TAG, "onStop"); } private class InitializationListener implements InitializationListener { @Override public void onInitializationComplete(. { try { Logger .d(TAG, "onInitializationComplete"); // Get Google's auth token from initialization listener GoogleSignInAccount acct = fireBaseLogin .getCurrentUser(); if (acct != null && acct .getEmail(. != null. { // User was already signed in via email Logger .d(TAG, "User was already signed in"); // Get credentials from initialization listener Credential creds = fireBaseLogin .getCurrentUser(.getCredentials(); // Store credential locally so that it can be used later if (creds != null. { getApplicationContext(. .getSharedPreferences(Constants .PREFS_FILE_NAME, Context .MODE_PRIVATE. .edit(. .putString(Constants .CREDENTIALS_USERNAME, creds .getUsername(). .commit(); } } else { // User signed in via email Logger .d(TAG, "User signed in via Email"); // Get credentials from initialization listener Credential creds = fireBaseLogin .getCurrentUser(.getCredentials(); // Store credential locally so that it can be used later if (creds != null. { getApplicationContext(. .getSharedPreferences(Constants .PREFS_FILE_NAME, Context .MODE_PRIVATE. .edit(. .putString(Constants .CREDENTIALS_USERNAME, creds .getUsername(). .commit(); } } } catch (Exception e. { e .printStackTrace(); } } public void onError(FirebaseError e. { e .printStackTrace(); } public void onComplete(. { Logger .d(TAG, "onComplete"); } } }

To make things more interesting, I have added error handling logic in the above code snippet so that if there are any issues with our Firebase project configuration or initialization process we can handle them gracefully by showing an error message at appropriate place on the screen or logging them in our log file using Logger class provided by Android SDK:

  • Update our AndroidManifest so that we can use this library throughout our app:

<?xml version="1.0" encoding="utf-8"?> <manifest

The process to integrate MongoDB Realm and Firebase Cloud Storage may seem complicated and intimidating. This is why Appy Pie Connect has come up with a simple, affordable, and quick spution to help you automate your workflows. Click on the button below to begin.