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

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

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

import com.eg.google.gson.JsonObject;
import com.eg.google.gson.JsonPrimitive;

public class EnvironmentInformation {
    private long[] diskAvailable;
    private long memoryUsage;
    private int orientation;
    private String networkStatus;
    private String networkWanType;
    private String country, adminArea;
    private String batteryStatus;
    private String batterylevel;
    private String deviceForm;
    private static EnvironmentInformation instance = new EnvironmentInformation();
    private String batteryChargingType;
    private String carrierName;

    public static EnvironmentInformation getInstance() {
        return instance;
    }

    public void setOrientation(int orientation) {
        this.orientation = orientation;
    }

    public void setNetworkStatus(String networkStatus) {
        this.networkStatus = networkStatus;
    }

    public void setNetworkWanType(String networkWanType) {
        this.networkWanType = networkWanType;
    }

    public int getOrientation() {
        return this.orientation;
    }

    public String getNetworkStatus() {
        return this.networkStatus;
    }

    public String getNetworkWanType() {
        return this.networkWanType;
    }

    public void setCountry(String Country) {
        this.country = Country;
    }

    public String getCountry() {
        return this.country;
    }

    public void setAdminArea(String adminArea) {
        this.adminArea = adminArea;
    }

    public String getAdminArea() {
        return this.adminArea;
    }

    public void setBatterylevel(String batterylevel) {
        this.batterylevel = batterylevel;
    }

    public void setBatteryStatus(String batteryStatus) {
        this.batteryStatus = batteryStatus;
    }

    public void setBatteryChargingType(String batteryChargingType) {
        this.batteryChargingType = batteryChargingType;
    }

    public String getBatteryStatus() {
        return this.batteryStatus;
    }

    public String getBatterylevel() {
        return this.batterylevel;
    }

    public String getBatteryChargingType() {
        return this.batteryChargingType;
    }

    public void setDeviceForm(String deviceForm) {
        this.deviceForm = deviceForm;
    }

    public void setCarrierName(String CarrierName) {
        carrierName = CarrierName;
    }

    public String getCarrierName() {
        return carrierName;
    }

    public long[] getDiskAvailable() {
        return diskAvailable;
    }

    public void setDiskAvailable(long[] diskAvailable) {
        this.diskAvailable = diskAvailable;
    }

    public long getMemoryUsage() {
        return memoryUsage;
    }

    public void setMemoryUsage(long memoryUsage) {
        this.memoryUsage = memoryUsage;
    }

    public String getDeviceForm() {
        return this.deviceForm;
    }

    public JsonObject asJsonObject() {

        JsonObject data = new JsonObject();
        data.add("orientation", new JsonPrimitive(this.orientation));
        data.add("networkStatus", new JsonPrimitive(this.networkStatus));
        data.add("networkWanType", new JsonPrimitive(this.networkWanType));
        data.add("country", new JsonPrimitive(this.country));
        data.add("batteryStatus", new JsonPrimitive(this.batteryStatus));
        data.add("batterylevel", new JsonPrimitive(this.batterylevel));
        data.add("deviceForm", new JsonPrimitive(this.deviceForm));
        data.add("adminArea", new JsonPrimitive(this.adminArea));
        data.add("batteryChargingType", new JsonPrimitive(this.batteryChargingType));
        data.add("carrierName", new JsonPrimitive(this.carrierName));
        return data;
    }

    public static EnvironmentInformation newFromJson(JsonObject jsonObject) {
        EnvironmentInformation info = new EnvironmentInformation();
        info.orientation = jsonObject.get("orientation").getAsInt();
        info.networkStatus = jsonObject.get("networkStatus").getAsString();
        info.networkWanType = jsonObject.get("networkWanType").getAsString();
        info.country = jsonObject.get("country").getAsString();
        info.batteryStatus = jsonObject.get("batteryStatus").getAsString();
        info.batterylevel = jsonObject.get("batterylevel").getAsString();
        info.deviceForm = jsonObject.get("deviceForm").getAsString();
        info.adminArea = jsonObject.get("adminArea").getAsString();
        info.batteryChargingType = jsonObject.get("batteryChargingType").getAsString();
        info.carrierName = jsonObject.get("carrierName").getAsString();
        return info;
    }

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy