Trip to Firebase as an Android Developer

Abhishek Kumar Sah
8 min readJun 6, 2019

--

Firebase is a comprehensive mobile development platform. They give you the tools to develop high-quality apps, grow your user base, and earn more money. Firebase cover the essentials so you can monetize your business and focus on your users.

The term essentials are divided into three parts:-

  • Building your App
  • Improving the Quality of App
  • Business Growth
To achieve the above essentials these are the tools developed by firebase.
  • Firebase gives you functionality like analytics, databases, messaging and crash reporting so you can move quickly and focus on your users.
  • Firebase helps in building applications without server side programming language.
  • Firebase is built on Google infrastructure and scales automatically, for even the largest apps.
  • It is supported on different platforms:- Android, iOS, Web, C++ and Unity.

In this blog, i will be discussing about all the above firebase tools and how to implement them in your android app.

Add Firebase to your Android project:-

There are two ways to connect your app to firebase:-

  • Option 1: (recommended) Use the Firebase console setup workflow.
  • Option 2: Use the Android Studio Firebase Assistant (requires additional configuration).

Option 1:- Using Firebase console setup

  1. On firebase console, click Add project, enter project name and edit the project id(optional). Follow the remaining setup steps in the Firebase console, then click Create project. (P.S:- You cannot add or modify project id after you register your app with your Firebase project.)
  2. On Firebase console page, click Android Icon to launch setup workflow. Enter your app’s Application ID in the Android Package name field. (Find this application Id in your app level - Gradle file). Enter other app information(optional) and click Register App.
  3. Click Download google-services.json to obtain your Firebase Android configuration file, and move your config file into the module (app-level) directory of your app.
  4. To enable firebase products in your app, add google-services plugin and check for Google’s Maven repository in project level gradle file.
Google-Services plugin and Maven repository

In your module (app-level) Gradle file (usually app/build.gradle), add a line to the bottom of the file.

In your module (app-level) Gradle file (usually app/build.gradle), add the dependency for the core Firebase Sdk:-

Firebase Core

Add the dependencies for the other Firebase libraries that you want to use. And sync your app to ensure that all dependencies have the necessary versions.

Option 2:- Using Android Studio Firebase Assistant

  • Open your Android project in Android Studio.
  • Select Tools > Firebase to open the Assistant window.
  • Click Connect to Firebase to register your app with an existing or new Firebase project and to automatically add the necessary files and code to your Android project.
  • Check that your plugin and library versions are up-to-date:-

i) In your root-level (project-level) Gradle file (build.gradle), check that your Google Services plugin version is up-to-date (com.google.gms:google-services:4.2.0).

ii) In your module (app-level) Gradle file (usually app/build.gradle), check that your Firebase Android library versions are up-to-date.

After integrating firebase in your app, lets talk about the products that firebase offers:-

Build better apps

Firebase lets you build more powerful, secure and scalable apps, using world-class infrastructure.

  • Firebase Authentication:- Manage your users in a simple and secure way. Firebase Auth offers multiple methods to authenticate, including email and password, third-party providers like Google or Facebook, and using your existing account system directly. Build your own interface, or take advantage of our open source, fully customizable UI.
Authentication Providers
  • Cloud Firestore:- Store and sync data between users and devices — at global scale — using a cloud-hosted, NoSQL database. Cloud Firestore gives you live synchronization and offline support along with efficient data queries. Its integration with other Firebase products enables you to build truly serverless apps.
Cloud Firestore
  • Firebase ML Kit :- Bring powerful machine learning features to your mobile app whether you’re new or experienced in ML. Get started easily by using our ready-to-use APIs for common mobile use cases, or import your own custom models which can be hosted and served to your apps by Firebase. ML Kit APIs can run on-device or in the cloud, depending on the functionality, and some give you both choices.
Firebase ML Kit
  • Cloud Functions:- Extend your app with custom backend code without needing to manage and scale your own servers. Functions can be triggered by events, which are emitted by Firebase products, Google Cloud services, or third parties, using webhooks.
Firebase Cloud Functions
  • Hosting:-Simplify your web hosting with tools made specifically for modern web apps. When you upload your web assets, we automatically push them out to our global CDN and give them a free SSL certificate so your users get a secure, reliable, low-latency experience, no matter where they are.
SSD- Backed Hosting
  • Cloud Storage:-Store and share user-generated content like images, audio, and video with powerful, simple, and cost-effective object storage built for Google scale. The Firebase SDKs for Cloud Storage add Google security to file uploads and downloads for your Firebase apps, regardless of network quality.
Firebase Cloud Storage
  • Realtime Database:-Realtime Database is Firebase’s original database. It’s an efficient, low-latency solution for mobile apps that require synced states across clients in realtime. We recommend Cloud Firestore instead of Realtime Database for most developers starting a new project.
Firebase Realtime Database

Improve app quality

Firebase gives you insights into app performance and stability, so you can channel your resources effectively.

  • Crashlytics:- Reduce your troubleshooting time by turning an avalanche of crashes into a manageable list of issues. Get clear, actionable insight into which issues to tackle first by seeing the user impact right in the Crashlytics dashboard. Realtime alerts will help you stay on top of stability even on the go. Crashlytics is the primary crash reporter for Firebase.
Crashlytics (Issue Tracker)
  • Performance Monitoring:- Diagnose app performance issues occurring on your users’ devices. Use traces to monitor the performance of specific parts of your app and see a summarized view in the Firebase console. Stay on top of your app’s start-up time and monitor HTTP requests without writing any code.
Pinpoint the origin of issues
  • Test Lab:- Run automatic and customized tests for your app on virtual and physical devices hosted by Google. Use Firebase Test Lab throughout your development lifecycle to discover bugs and inconsistencies so that you can offer up a great experience on a wide variety of devices.
Test your app — no coding required!

Grow your business

Firebase helps you grow to millions of users, simplifying user engagement and retention.

  • In-App Messaging BETA:- Engage and nurture your active users with targeted and contextual messages that encourage them to complete meaningful actions within your app. You have the power to trigger messages based on user behavior and interests. You can also customize the design of in-app messages to fit your brand. In-App Messaging supports a variety of use cases and formats.
Trigger messages based on behavior and interests
  • Google Analytics:- Analyze user attributions and behavior in a single dashboard to make informed decisions on your product roadmap. Gain realtime insights from reports, or export your raw event data to Google BigQuery for custom analysis.
User insights from acquisition to app usage
  • Predictions:- Harness the power of Google’s machine learning to get insight into which segments of users are likely to churn or spend (or complete another conversion event). Use these smart predictive segments for targeting in other products like Remote Config, Cloud Messaging, and In-App Messaging.
Insight into prediction inputs and performance
  • A/B Testing BETA :- Improve your app by running product and marketing experiments, without worrying about setting up the infrastructure to run A/B tests. Customize experiments to suit your goals. Test a variety of updates to your app, like message copy or new features. Then, only roll-out changes proven to move the needle on your key metrics.
Customize experiments to test a variety of updates
  • Cloud Messaging:- Send messages and notifications to users across platforms — Android, iOS, and the web — for free. Messages can be sent to single devices, groups of devices, or specific topics or user segments. Firebase Cloud Messaging (FCM) scales to even the largest apps, delivering hundreds of billions of messages per day.
Customized notification content
  • Remote Config:- Customize how your app renders for each user. Change the look and feel, roll out features gradually, run A/B tests, deliver customized content to certain users, or make other updates without deploying a new version — all from the Firebase console. Monitor the impact of your changes and make adjustments in a matter of minutes.
Tailor your app to different audiences
  • Dynamic Links:- Use Dynamic Links to deliver a customized user experience for iOS, Android, and the web. You can use them to power mobile web to drive native app conversions, user to user sharing, social and marketing campaigns, and more. Dynamic Links provides you with the attributions you need to better understand your mobile growth.
Convert mobile web users to native app users

Firebase offers so many features to build better apps and grow successful businesses. This blog was a short trip to all those tools offered by firebase. Every tool has a link which lead to firebase documentation of that particular product.

Happy Reading!

📝 Read this story later in Journal.

👩‍💻 Wake up every Sunday morning to the week’s most noteworthy stories in Tech waiting in your inbox. Read the Noteworthy in Tech newsletter.

--

--

Abhishek Kumar Sah

Android Developer | Open Source Enthusiast | Writer at NoteWorthy — The Journal Blog