In this tutorial, you lot volition larn to integrate or add together Google firebase analytics to your android project. Firebase analytics collects usage as well as conduct information for your application or game. If you lot already integrate whatever of the firebase services inward your android app or game as well as hence adding firebase analytic is real easy. If not, don’t worry. In this tutorial, I volition exhibit you lot step-by-step guide to integrate Google firebase as well as firebase analytic inward your android application alongside uncomplicated event as well as you lot tin lavatory download this sample projection source code from GitHub at last.
Integrating Google Firebase Analytics to your Android Project: Get Started alongside Firebase Analytics for Android
Before starting to add together google firebase analytic to your android project, brand for sure your device is running Android 2.3 (Gingerbread) or newer, as well as Google Play services 9.2.1 or newer as well as Android Studio 1.5 or higher.
1. Create a novel Android Project using Android Studio
Create a novel android projection alongside the packet name: Add Firebase Analytics to Android Project as well as select minimum SDK: API nine Android 2.3 (Gingerbread) or higher.
2. Install the Firebase ADK to your Android Project
To integrate the firebase libraries into your ain android project, you lot demand to perform for sure tasks.
2.1. Open your projection marking (top level) build.gradle file as well as add together classpath ‘com.google.gms:google-services:3.0.0’ as a dependencies. Your projection marking build.gradle file volition await similar below.
Project marking build.gradle file
2.2. Now opened upwardly your app marking build.gradle file as well as add together compile ‘com.google.firebase:firebase-core:9.2.1’ as app dependencies as well as apply plugin: ‘com.google.gms.google-services’ at the bottom. Your app marking build.gradle file volition await similar below.
App marking build.gradle file
3. Adding Internet Permission inward your Application AndroidManifest.xml File
In your app’s AndroidManifest.xml file you lot demand to add together cyberspace user permission. Open AndroidManifest.xml file as well as add together android.permission.INTERNET which is await similar below.
4. Add Your App to Your Firebase Project inward the Firebase Console
4.1. Go to Google Firebase Developer Console
4.2. Create novel project.
4.3. H5N1 dialog box volition appear, add together projection name: Google Firebase Analytics as well as select your province as well as click Create Project button.
4.4. After creating novel projection inward Google firebase developer console, novel hide volition look similar below.
4.5. Click add together firebase to your android app. Here you lot demand to render your app packet name.
4.6. Add projection packet cite inward the box as well as click Add App button. H5N1 file google-services.json is downloaded. Click Continue as well as Finish button.
5. Adding google-services.json File to Your Project
5.1. Go to android studio. Switch to the projection sentiment inward Android Studio.
5.2. Add google-services.json file that you lot only downloaded to your android app directory similar the screenshot below.
6. Adding Firebase Analytics for Android to Your Android App
In android studio, in 1 lawsuit to a greater extent than opened upwardly app marking build.gradle file as well as add together compile ‘com.google.android.gms:play-services-analytics:9.2.1’ as app dependencies. Following is the in conclusion content of app marking build.gradle file.
App marking build.gradle file
7. Check Your App Report inward Google Firebase Analytics
7.1. Go to Firebase Developers Console.
7.2. Choose your app
7.3. Click Analytics from left menu. For the starting fourth dimension time, it volition await similar below.
After roughly hours or twenty-four hours you lot tin lavatory run across your app’s consummate reports similar below.
That’s all. You bring done all things. Now you lot tin lavatory run across your application’s consummate study inward Google firebase analytic. It’s real slow as well as uncomplicated to integrate.
8. Java Activity File as well as XML Layout File
Following is the content of XML layout file.
Following is the consummate content of coffee action file.
Download Complete Project Source Code
You tin lavatory download consummate event projection source code from GitHub.