Firebase gives you the tools to develop high-quality apps, grow your user base, and earn more money. We cover the essentials so you can monetize your business and focus on your users.

Prerequisites

  • A device running Android 2.3 (Gingerbread) or newer, and Google Play services 9.0.0 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

or upgrading to the Android Studio 2.2 preview.

If you don’t have an Android Studio project already, you can download one of our quickstart samples if you just want to try a Firebase feature. If you’re using a quickstart, remember to get the package name from the ApplicationManifest.xml, you’ll need it for the next step.

to get started.

Add Firebase to your app

It’s time to add Firebase to your app. To do this you’ll need a Firebase project and a Firebase configuration file for your app.

  1. Create a Firebase project in the Firebase console, if you don’t already have one. If you already have an existing Google project associated with your mobile app, click Import Google Project. Otherwise, clickCreate New Project.
  2. Click Add Firebase to your Android app and follow the setup steps. If you’re importing an existing Google project, this may happen automatically and you can just download the config file.
  3. When prompted, enter your app’s package name. It’s important to enter the package name your app is using; this can only be set when you add an app to your Firebase project.
  4. At the end, you’ll download a google-services.json file. You can download this file again at any time.
  5. If you haven’t done so already, copy this into your project’s module folder, typically app/.

Add the SDK

If you would like to integrate the Firebase libraries into one of your own projects, you need to perform a few basic tasks to prepare your Android Studio project. You may have already done this as part of adding Firebase to your app.

First, add rules to your root-level build.gradle file, to include the google-services plugin:

buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

Then, in your module Gradle file (usually the app/build.gradle) file, add the apply plugin line at the bottom of the file to enable the Gradle plugin:

apply plugin: 'com.android.application'

android {
  // ...
}

dependencies {
  // ...
  compile 'com.google.firebase:firebase-core:10.2.1'

  // Getting a "Could not find" error? Make sure you have
  // the latest Google Repository in the Android SDK manager
}

// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

You should also add the dependencies for the Firebase SDKs you wish to use – we recommend starting with thefirebase-core, which include Firebase Analytics, but see below for the full list.

Available libraries

These libraries are available for the different Firebase features.

Gradle Dependency LineService
com.google.firebase:firebase-core:9.0.0Analytics
com.google.firebase:firebase-database:9.0.0Realtime Database
com.google.firebase:firebase-storage:9.0.0Storage
com.google.firebase:firebase-crash:9.0.0Crash Reporting
com.google.firebase:firebase-auth:9.0.0Authentication
com.google.firebase:firebase-messaging:9.0.0Cloud Messaging / Notifications
com.google.firebase:firebase-config:9.0.0Remote Config
com.google.firebase:firebase-invites:9.0.0Invites / Dynamic Links
com.google.firebase:firebase-ads:9.0.0AdMob
com.google.android.gms:play-services-appindexing:9.0.0App Indexing

 

from Google Docs
you can use Google Docs for more information…
Subscribe To Android Learning

Subscribe To Android Learning

Join our mailing list to receive the latest android tutorials from our site.

You have Successfully Subscribed!

Pin It on Pinterest

Shares
Share This