[Solved] how to integrate firebase performance monitoring in Android [closed]


1. Go to project level build.gradle and add 

buildscript {
    repositories {
        jcenter()
        mavenLocal()
        google()

    }

    dependencies {
        //Your gradle version example classpath 'com.android.tools.build:gradle:3.1.3'
        //play services plugin example classpath 'com.google.gms:google-services:3.2.0'

        classpath 'com.google.firebase:firebase-plugins:1.1.5'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

2. App level build.gradle add apply plugin: 'com.google.firebase.firebase-perf' below com.android.application

-In dependencies add firebase-perf

android.applicationVariants.all {
    // Set this to false to disable Firebase Performance Monitoring at compile time
    FirebasePerformance {
        instrumentationEnabled true
    }
}

dependencies{
    implementation 'com.google.firebase:firebase-perf:16.0.0'
}

-At the bottom add below line

apply plugin: 'com.google.gms.google-services'

3. You can monitor Network request, traces and method response time by adding below code in activity or class
@AddTrace(name = "devcie_info", enabled = true)
getdeviceInfo(){}

-For Traces
Trace myTrace = FirebasePerformance.getInstance().newTrace("test_trace");
myTrace.start();
getdeviceInfo(){}
myTrace.stop();

-Network Requests
HttpMetric metric = FirebasePerformance.getInstance().newHttpMetric(url, FirebasePerformance.HttpMethod.GET);
on response set response code and payload size
metric.setRequestPayloadSize(response.length());
metric.setHttpResponseCode(httpURLConnection.getResponseCode());
metric.stop();

For detailed information go to [Link][https://firebase.google.com/docs/perf-mon/get-started-android]

2

solved how to integrate firebase performance monitoring in Android [closed]