All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.eg.agent.android.ApplicationStateMonitorAgent Maven / Gradle / Ivy

There is a newer version: 2.1.3
Show newest version
package com.eg.agent.android;


import com.eg.agent.android.trace.Trace;
import com.eg.google.gson.JsonObject;
import com.eg.google.gson.JsonPrimitive;

public class ApplicationStateMonitorAgent
{
    private String applicationStatus;
    private String activityName;
    private long activityStartTime;
    public long getActivityStartTime() {
        return activityStartTime;
    }


    public void setActivityStartTime(long activityStartTime) {
        this.activityStartTime = activityStartTime;

    }

    public String getActivityName() {
        return activityName;
    }

    public void setActivityName(String activityName) {
        this.activityName = activityName;
    }
    public JsonObject asJsonObject() {

        JsonObject data = new JsonObject();
        Trace.ActiviteClassName=activityName;
        data.add("Activity_name",new JsonPrimitive(this.activityName));
        data.add("Activity_ressponseTime",new JsonPrimitive(this.activityStartTime));
        data.add("Activity_status",new JsonPrimitive(this.applicationStatus));
       

        return data;
    }
    private static ApplicationStateMonitorAgent instance=new ApplicationStateMonitorAgent();

    public static ApplicationStateMonitorAgent getInstance(){
        return instance;
    }
    public String getApplicationStatus() {
        return applicationStatus;
    }

    public void setApplicationStatus(String applicationStatus) {
        this.applicationStatus = applicationStatus;
    }
    public void ActivityMonitor(String activityName,long activityStartTime, String applicationStatus)
    {
        this.activityName=activityName;
        this.activityStartTime=activityStartTime;
        this.applicationStatus=applicationStatus;
        //Log.e("eG", applicationStatus);
        String launch_time = "" + String.valueOf(System.currentTimeMillis() - activityStartTime) + " sec";
        if(this.applicationStatus=="Foreground") {
            //Log.e("eG", applicationStatus);
            //DataSendToRum.sendData(activityName, launch_time,applicationStatus);
        	DataSendToRum.SendToCollector("Activity",instance);
       }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy