-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Building Data driven Apps with Firebase
At this year's Google I/O, Google announced a number of interesting new features in Firebase. The new Firebase is said to be a “Unified app platform for mobile developers” adding new tools to help develop faster, improve app quality, engage users and monetize apps.
For a quick intro to what the new Firebase is about, you can watch this video.
The new features that are included in this new Firebase include:
- Crash Reporting
- Cloud Messaging
- Realtime database and storage
- Analytics.
- Notifications.
- Dynamic Links.
- App Indexing.
- AdWords.
- Firebase Invites etc
First point to get started with Firebase, is to create an account here if you don't have one already.
Before you can begin to enjoy the new Firebase, please ensure your development machine satisfies these prerequisites:
- A device running Android 2.3 (Gingerbread) or newer, and Google Play services 9.0.1 or newer
- The Google Play services SDK from the Android SDK Manager
- Android Studio 1.5 or higher
- An Android Studio project and its package name
Next step is to add Firebase to your app on the Firebase console. Follow the following steps to add firebase to your app.
Navigate to the console. If you don't already have an existing Firebase project, click on "Create new project" and follow through the steps as shown in the gif below. Else, if you have an exisiting Google project, click on "Import Google Project"
Now that you've created the project, in the dashboard, click on "Add Firebase to your Android app".
To proceed, you need at least a package name unique to your app. If you plan on using Dynamic Links, Invites, and Google Sign-In support in Auth, you have to include a debug signing key SHA1 fingerprint.
To see your debug key SHA1 fingerprint, run the following command if you use Linux or Mac:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
If you're running Windows, use this command:
keytool -list -v -keystore C:\Documents and Settings\[User Name]\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android
The whole process is as shown below:
Clicking add app will download a google-services.json
file. You should move this file to your projects app module directory. Usually <project>/app
directory. Click continue and follow these instructions:
- In your project-level build.gradle file, add the following lines (
<project>/build.gradle
):
buildscript {
dependencies {
// Add this line
classpath 'com.google.gms:google-services:3.0.0'
}
}
- In your app-level build.gradle (
<project>/<app-module>/build.gradle
):
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
// ...
implementation 'com.google.firebase:firebase-core:9.0.0'
}
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'
Sync your gradle files with the project and you're ready to go with firebase.
This guide was originally drafted by Segun Famisa.
Created by CodePath with much help from the community. Contributed content licensed under cc-wiki with attribution required. You are free to remix and reuse, as long as you attribute and use a similar license.
Finding these guides helpful?
We need help from the broader community to improve these guides, add new topics and keep the topics up-to-date. See our contribution guidelines here and our topic issues list for great ways to help out.
Check these same guides through our standalone viewer for a better browsing experience and an improved search. Follow us on twitter @codepath for access to more useful Android development resources.