Set build property to String
MODIFY
analytics/src/main/java/com/segment/analytics/Analytics.java
analytics/src/main/java/com/segment/analytics/Analytics.java
@@ -349,15 +349,15 @@ public class Analytics {
"Application Installed",
new Properties() //
.putValue(VERSION_KEY, currentVersion)
- .putValue(BUILD_KEY, currentBuild));
+ .putValue(BUILD_KEY, String.valueOf(currentBuild)));
} else if (currentBuild != previousBuild) {
track(
"Application Updated",
new Properties() //
.putValue(VERSION_KEY, currentVersion)
- .putValue(BUILD_KEY, currentBuild)
+ .putValue(BUILD_KEY, String.valueOf(currentBuild))
.putValue("previous_" + VERSION_KEY, previousVersion)
- .putValue("previous_" + BUILD_KEY, previousBuild));
+ .putValue("previous_" + BUILD_KEY, String.valueOf(previousBuild)));
}
// Update the recorded version.

MODIFY
analytics/src/main/java/com/segment/analytics/AnalyticsActivityLifecycleCallbacks.java
analytics/src/main/java/com/segment/analytics/AnalyticsActivityLifecycleCallbacks.java
@@ -131,7 +131,7 @@ class AnalyticsActivityLifecycleCallbacks implements Application.ActivityLifecyc
if (firstLaunch.get()) {
properties
.putValue("version", packageInfo.versionName)
- .putValue("build", packageInfo.versionCode);
+ .putValue("build", String.valueOf(packageInfo.versionCode));
}
properties.putValue("from_background", !firstLaunch.getAndSet(false));
analytics.track("Application Opened", properties);

MODIFY
analytics/src/test/java/com/segment/analytics/AnalyticsTest.java
analytics/src/test/java/com/segment/analytics/AnalyticsTest.java
@@ -810,7 +810,7 @@ public class AnalyticsTest {
&& //
payload.properties().getString("version").equals("1.0.0")
&& //
- payload.properties().getInt("build", -1) == 100;
+ payload.properties().getString("build").equals(String.valueOf(100));
}
}));
@@ -894,11 +894,11 @@ public class AnalyticsTest {
&& //
payload.properties().getString("previous_version").equals("1.0.0")
&& //
- payload.properties().getInt("previous_build", -1) == 100
+ payload.properties().getString("previous_build").equals(String.valueOf(100))
&& //
payload.properties().getString("version").equals("1.0.1")
&& //
- payload.properties().getInt("build", -1) == 101;
+ payload.properties().getString("build").equals(String.valueOf(101));
}
}));
}
@@ -1301,7 +1301,7 @@ public class AnalyticsTest {
protected boolean matchesSafely(TrackPayload payload) {
return payload.event().equals("Application Opened")
&& payload.properties().getString("version").equals("1.0.0")
- && payload.properties().getInt("build", -1) == 100
+ && payload.properties().getString("build").equals(String.valueOf(100))
&& !payload.properties().getBoolean("from_background", true);
}
}));

Set build property to String