diff --git a/Branch-SDK/src/main/java/io/branch/referral/DeviceInfo.java b/Branch-SDK/src/main/java/io/branch/referral/DeviceInfo.java index 20c9d5fa7..7835985c4 100644 --- a/Branch-SDK/src/main/java/io/branch/referral/DeviceInfo.java +++ b/Branch-SDK/src/main/java/io/branch/referral/DeviceInfo.java @@ -90,8 +90,6 @@ void updateRequestWithV1Params(ServerRequest serverRequest, JSONObject requestOb requestObj.put(Defines.Jsonkey.APILevel.getKey(), SystemObserver.getAPILevel()); - maybeAddSDFields(serverRequest, requestObj); - if (Branch.getPluginName() != null) { requestObj.put(Defines.Jsonkey.PluginName.getKey(), Branch.getPluginName()); requestObj.put(Defines.Jsonkey.PluginVersion.getKey(), Branch.getPluginVersion()); @@ -111,6 +109,15 @@ void updateRequestWithV1Params(ServerRequest serverRequest, JSONObject requestOb if ((!TextUtils.isEmpty(localIpAddr))) { requestObj.put(Defines.Jsonkey.LocalIP.getKey(), localIpAddr); } + + if (serverRequest.isInitializationOrEventRequest()) { + requestObj.put(Defines.Jsonkey.CPUType.getKey(), SystemObserver.getCPUType()); + requestObj.put(Defines.Jsonkey.DeviceBuildId.getKey(), SystemObserver.getDeviceBuildId()); + requestObj.put(Defines.Jsonkey.Locale.getKey(), SystemObserver.getLocale()); + requestObj.put(Defines.Jsonkey.ConnectionType.getKey(), SystemObserver.getConnectionType(context_)); + requestObj.put(Defines.Jsonkey.DeviceCarrier.getKey(), SystemObserver.getCarrier(context_)); + requestObj.put(Defines.Jsonkey.OSVersionAndroid.getKey(), SystemObserver.getOSVersion()); + } } catch (JSONException e) { BranchLogger.d(e.getMessage()); } @@ -170,8 +177,6 @@ void updateRequestWithV2Params(ServerRequest serverRequest, PrefHelper prefHelpe userDataObj.put(Defines.Jsonkey.APILevel.getKey(), SystemObserver.getAPILevel()); - maybeAddSDFields(serverRequest, userDataObj); - if (Branch.getPluginName() != null) { userDataObj.put(Defines.Jsonkey.PluginName.getKey(), Branch.getPluginName()); userDataObj.put(Defines.Jsonkey.PluginVersion.getKey(), Branch.getPluginVersion()); @@ -217,22 +222,20 @@ void updateRequestWithV2Params(ServerRequest serverRequest, PrefHelper prefHelpe ((ServerRequestGetLATD) serverRequest).getAttributionWindow()); } + if (serverRequest.isInitializationOrEventRequest()) { + userDataObj.put(Defines.Jsonkey.CPUType.getKey(), SystemObserver.getCPUType()); + userDataObj.put(Defines.Jsonkey.DeviceBuildId.getKey(), SystemObserver.getDeviceBuildId()); + userDataObj.put(Defines.Jsonkey.Locale.getKey(), SystemObserver.getLocale()); + userDataObj.put(Defines.Jsonkey.ConnectionType.getKey(), SystemObserver.getConnectionType(context_)); + userDataObj.put(Defines.Jsonkey.DeviceCarrier.getKey(), SystemObserver.getCarrier(context_)); + userDataObj.put(Defines.Jsonkey.OSVersionAndroid.getKey(), SystemObserver.getOSVersion()); + } + } catch (JSONException e) { BranchLogger.d(e.getMessage()); } } - private void maybeAddSDFields(ServerRequest serverRequest, JSONObject requestObj) throws JSONException { - if (serverRequest.isInitializationOrEventRequest()) { - requestObj.put(Defines.Jsonkey.CPUType.getKey(), SystemObserver.getCPUType()); - requestObj.put(Defines.Jsonkey.DeviceBuildId.getKey(), SystemObserver.getDeviceBuildId()); - requestObj.put(Defines.Jsonkey.Locale.getKey(), SystemObserver.getLocale()); - requestObj.put(Defines.Jsonkey.ConnectionType.getKey(), SystemObserver.getConnectionType(context_)); - requestObj.put(Defines.Jsonkey.DeviceCarrier.getKey(), SystemObserver.getCarrier(context_)); - requestObj.put(Defines.Jsonkey.OSVersionAndroid.getKey(), SystemObserver.getOSVersion()); - } - } - /** * get the package name for the this application *