summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapLoadEvent.java
blob: e0a7f17e01eaf1318cb87dffe2ed9af5b6b8c73a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package com.mapbox.mapboxsdk.module.telemetry;

import android.annotation.SuppressLint;
import android.os.Build;
import android.os.Parcel;

import com.mapbox.android.telemetry.Event;
import com.mapbox.mapboxsdk.BuildConfig;

/**
 * Event will be sent while map is loaded.
 */
@SuppressLint("ParcelCreator")
class MapLoadEvent extends Event {
  private final String event = "map.load";
  private final String operatingSystem = "Android - " + Build.VERSION.RELEASE;
  private final String sdkIdentifier = BuildConfig.MAPBOX_SDK_IDENTIFIER;
  private final String sdkVersion = BuildConfig.MAPBOX_SDK_VERSION;
  private final String model = Build.MODEL;
  private final String created;
  private final String userId;
  private final String carrier;
  private final String cellularNetworkType;
  private final String orientation;
  private final float resolution;
  private final float accessibilityFontScale;
  private final int batteryLevel;
  private final boolean pluggedIn;
  private final boolean wifi;


  MapLoadEvent(String userId, PhoneState phoneState) {
    this.created = phoneState.getCreated();
    this.userId = userId;
    this.batteryLevel = phoneState.getBatteryLevel();
    this.pluggedIn = phoneState.isPluggedIn();
    this.cellularNetworkType = phoneState.getCellularNetworkType();
    this.carrier = phoneState.getCarrier();
    this.resolution = phoneState.getResolution();
    this.accessibilityFontScale = phoneState.getAccessibilityFontScale();
    this.wifi = phoneState.isWifi();
    this.orientation = phoneState.getOrientation();
  }

  String getOperatingSystem() {
    return operatingSystem;
  }

  String getSdkIdentifier() {
    return sdkIdentifier;
  }

  String getSdkVersion() {
    return sdkVersion;
  }

  String getModel() {
    return model;
  }

  String getCreated() {
    return created;
  }

  String getUserId() {
    return userId;
  }

  String getCarrier() {
    return carrier;
  }

  String getCellularNetworkType() {
    return cellularNetworkType;
  }

  String getOrientation() {
    return orientation;
  }

  float getResolution() {
    return resolution;
  }

  float getAccessibilityFontScale() {
    return accessibilityFontScale;
  }

  int getBatteryLevel() {
    return batteryLevel;
  }

  boolean isPluggedIn() {
    return pluggedIn;
  }

  boolean isWifi() {
    return wifi;
  }

  @Override
  public int describeContents() {
    return 0;
  }

  @Override
  public void writeToParcel(Parcel dest, int flags) {
  }
}