FireBase


 

Steps to do before:

Open Firebase Console:

firebase select project type

Create a new project.

 

firebase_create_new_project

Enter your app name and select your country and press the create project button.

 

firebase_enter_project_details

Enter the package name of your project in which you are going to integrate the Firebase.

 

firebase_copy_config_file

Here the google-services.json file will be downloaded and place it in the root director of your project.

Note: This step is very important as your project won’t build without this file.

 

firebase_add_to_gradle

Add Dependencies to Gradle file,

project-level build.gradle

app-level build.gradle

Available libraries

These libraries are available for the different Firebase features.

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

 

Note this tutorial covers firebase analytics, cloud messaging, realtime database, authentication and admob services. Soon we’ll cover all the topics.

 

Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.

Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open src -> package -> MainActivity.java and add following code :

Step 4 : Open res -> layout -> Create new xml, home.xml and add following code :

Step 5 : Open src -> package -> Create new class, HomeFragment.java and add following code :

Step 6 : Open res -> layout -> Create new xml, login_signup.xml and add following code :

Step 7 : Open src -> package -> Create new class, LoginSignUpFragment.java and add following code :

Step 8 : Open src -> package -> Create new class, MyFirebaseMessagingService.java and add following code :

Step 9 : Open AndroidManifest.xml and add following code :

Step 10 : Open build.gradle(Module: app) and add following code :

ScreenShot:

vector_drawable_normal.pngvector_drawable_normal.pngvector_drawable_normal.png
vector_drawable_normal.pngvector_drawable_normal.png
vector_drawable_normal.pngfirebase_db_home_screen.pngfirebase_db_add_todo_item.png
firebase_db_todo_items.pngfirebase_db_todo_item_update.png
firebase_db_console
firebase_db_console_update
firebase_notification_console
firebase_fcm_first_push_noti.pngfirebase_admob_interstitial_ad.png

Download SourceCode