Add type to device context
MODIFY
analytics/src/main/java/com/segment/analytics/AnalyticsContext.java
analytics/src/main/java/com/segment/analytics/AnalyticsContext.java
@@ -239,6 +239,7 @@ public class AnalyticsContext extends ValueMap {
device.put(Device.DEVICE_MANUFACTURER_KEY, Build.MANUFACTURER);
device.put(Device.DEVICE_MODEL_KEY, Build.MODEL);
device.put(Device.DEVICE_NAME_KEY, Build.DEVICE);
+ device.put(Device.DEVICE_TYPE_KEY, "android");
put(DEVICE_KEY, device);
}
@@ -414,6 +415,7 @@ public class AnalyticsContext extends ValueMap {
@Private static final String DEVICE_MANUFACTURER_KEY = "manufacturer";
@Private static final String DEVICE_MODEL_KEY = "model";
@Private static final String DEVICE_NAME_KEY = "name";
+ @Private static final String DEVICE_TYPE_KEY = "type";
@Private static final String DEVICE_TOKEN_KEY = "token";
@Private static final String DEVICE_ADVERTISING_ID_KEY = "advertisingId";
@Private static final String DEVICE_AD_TRACKING_ENABLED_KEY = "adTrackingEnabled";

MODIFY
analytics/src/test/java/com/segment/analytics/AnalyticsContextTest.java
analytics/src/test/java/com/segment/analytics/AnalyticsContextTest.java
@@ -82,7 +82,8 @@ public class AnalyticsContextTest {
.containsEntry("id", "unknown")
.containsEntry("manufacturer", "unknown")
.containsEntry("model", "unknown")
- .containsEntry("name", "unknown");
+ .containsEntry("name", "unknown")
+ .containsEntry("type", "android");
assertThat(context.getValueMap("library")) //
.containsEntry("name", "analytics-android")
@@ -109,7 +110,8 @@ public class AnalyticsContextTest {
.containsEntry("id", traits.anonymousId())
.containsEntry("manufacturer", "unknown")
.containsEntry("model", "unknown")
- .containsEntry("name", "unknown");
+ .containsEntry("name", "unknown")
+ .containsEntry("type", "android");
}
@Test

Add type to device context (#655)