Showing posts with label Firebase Event Track. Show all posts
Showing posts with label Firebase Event Track. Show all posts

Monday, November 21, 2016

Firebase Analytics


Firebase Analytics is a free, out-of-the-box analytics solution that inspires actionable insights based on app usage and user engagement.




 Points to integrate Firebase Analytics in your project.
  1. Crate a project in android studio.
  2. Open build.gradle(project) and add a class path to it(
    classpath 'com.google.gms:google-services:3.0.0'). After adding the class path it will be look like this-
    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
        repositories {
            jcenter()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:2.2.0'
    
            //________class path for google service
            classpath 'com.google.gms:google-services:3.0.0'
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            jcenter()
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    
      
  3. Open build.gradle(app).
  4. Add a dependancy (<project>/<app-module>/build.gradle)-
    •  compile 'com.google.firebase:firebase-core:9.0.0'
  5. Add a plugin in the bottom of build.gradle(<project>/<app-module>/build.gradle)-
    •  apply plugin: 'com.google.gms.google-services' .
  6. After adding dependency and plugin your app level build.gradle will be look like this- 
    apply plugin: 'com.android.application'
    android {
    
        compileSdkVersion 23
        buildToolsVersion "23.0.2"
    
        defaultConfig {
            applicationId "com.pankaj.firebaseanalytics"
            minSdkVersion 15
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
    
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'com.android.support:appcompat-v7:23.2.1'
        testCompile 'junit:junit:4.12'
    
    /*______________________for firebase analytics______________________*/
        compile 'com.google.firebase:firebase-core:9.0.0'
      
    }
    
    apply plugin: 'com.google.gms.google-services'
    
      


  7. Now your updated manifest.xml will be look like this-

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.pankaj.firebaseanalytics">
    
        <!--permissions-->
        <uses-permission android:name="android.permission.INTERNET" />
    
        <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">
    
            <!--activities-->
            <activity android:name=".MainActivity">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
    </manifest> 

  8.  Now go to the Firebase developer console and create a new project

  9.  Enter your application name and select your country. then click on "create project"

  10.  Now you will see a screen like this
  11. then click on "add Firebase to your Android app".
  12. Now put 
    1. Package name  
    2. App nickname (optional)
    3. Debug signing certificate SHA-1 (optional) 

  13.  Copy and paste the google-services.json file into the application root directory.



  14. Open main activity and put the following codes.

    package com.pankaj.firebaseanalytics;
    import android.os.Bundle;
    import android.support.v7.app.AppCompatActivity;
    import com.google.firebase.analytics.FirebaseAnalytics;
    
    public class MainActivity extends AppCompatActivity {
    
        private FirebaseAnalytics mFirebaseAnalytics;
        private String APP_OPEN = "APP_OPEN";
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            initializeAnalitics();
        }
    
        /*_________________________ Initialize Analytics ___________________________*/
        private void initializeAnalitics() {
            mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
            addEventsToAnalitics(APP_OPEN, APP_OPEN);
        }
    
         /*_________________________ Send Event ___________________________*/
        public void addEventsToAnalitics(String event, String message) {
            Bundle params = new Bundle();
            params.putString("message", message);
            mFirebaseAnalytics.logEvent(event, params);
        }
    }
    
      
  15. Now firebase analytics have integrated in application. Run this app and go to the firebase console to check analytics data, then we will see the window like-



  16. Analytics data will be show within 24 hours. After 24 hours above window shows data like this-

  17. Good bye, Thanks to read this blog.


Home

Android Version History & Main Features - It took only five years from the release of the first device running Android for the platform to become the most popular mobile operating system on the planet.


Hello World - It will be a simple program in which we will see how to output a sample text, say, Hello World.




Toast Message - In Android, Toast is a notification message that pop up for certain amount of time, and automtaically fades out, most people just use it for display sort message.


Radio Group/RadioButton - In Android, Radio Group/Radio Button is use to select single option from number of choice. For the better user interference this is very important to customize the radio button according to need of theme. In this tutorial i am covering some points of customization.


Firebase Cloud Messaging (FCM) - Google has an alternative which is easier than gcm. 

 
Firebase Analytics - Firebase Analytics is a free, out-of-the-box analytics solution that inspires actionable insights based on app usage and user engagement. 


Simple Webservice - A web service is a standard for exchanging information between different types of applications irrespective of language and platform. 


Image Loader - Universal Image Loader aims to provide a powerful, flexible and highly customizable instrument for image loading, caching and displaying. It provides a lot of configuration options and good control over the image loading and caching process.

 
CheckBox - In Android, Checkbox is use to select multiple options from number of choice.


Spinner - Spinner is use to select single option from number of listed choice.


Rating Bar - Rating Bar is use to get/indicate rating .


TimePicker - Time Piker is a type of dialog in android which is used to get time by the user. 

Progress Bar - Progress Bar is a element used to visualize the progression of an extended running operation, such as a download, file transfer, or installation. Sometimes, the graphic is accompanied by a textual representation of the progress in a percent format.


Facebook Integration - To provide the one click signup and signin process in the application, Android developers provide the login with social sites facilities like- facebook, twitter, linkedin, g+ etc. This tutorial guide you for facebook one click signup and signin process.  


RecyclerView is more advanced version of ListView with improved performance and other benefits. In this tutorial i am using creating vertical and horizontal listing with card view. 


Linkedin Integration - To provide the one click signup and signin process in the application, Android developers provide the login with social sites facilities like- facebook, twitter, linkedin, g+ etc. This tutorial guide you for Linkedin one click signup and signin process.


Place Picker is use to select single place from number of place choice on map.
  

Menu - Context Menu, Option Menu, Popup Menu, Main Menu. Menu is use to select single option from number of listed choice.



Place search is used to search place by entering keyword in search field, then this provides the suggested list of place and choose any one from number of suggested place. 



Intent, Explicit Intent - When a intent is created with directly define target component then it is called Explicit Intent.




NestedScrollView is just like ScrollView, but it supports acting as both a nested scrolling parent and child on both new and old versions of Android. Nested scrolling is enabled by default.


Fragment in this tutorial i will cover creation of fragment, BackStack, POP From BackStack etc.


Square image view is used to show a non square image into the form of square.



Send mail in background - Send mail in background is a process to send mail by without open default mail composer. By this we can send number of mail in the background. Also if an application owner wants to send mail in the background without knowing to user, then this is also usefull in this case.

Top activity name tutorial will help you to get name of top running activity name.

Life Cycle tutorial covered the all information about the activity and application life cycle .

For the multi selection used multiselection autocomplete textview at the place of autocomplete textview.

Custom Logs is used to show all information's of logs (like name of class->function->line number->tags and message).

Single Auto Selection and Entry with Delete is used to select values from number of options and delete selected one.

This tutorial will help you to enter and get text in recycler view.

Base Activity is used to reuse code on the different place for the same purpose.


Bar Code & QR Code Scanner is used to scan BAR & QR code scanning. you can see it in this tutorial.

Autofit Recyclerview  is used to show number of column which can be auto adjust with screen size. you can see it in this tutorial.





Single Auto Selection and Entry with Delete is used to select values from number of options and delete selected one.

This tutorial will help you to enter and get text in recycler view.