diff --git a/parsely/src/main/java/com/parsely/parselyandroid/ParselyTracker.java b/parsely/src/main/java/com/parsely/parselyandroid/ParselyTracker.java index 9e966157..b10660a7 100644 --- a/parsely/src/main/java/com/parsely/parselyandroid/ParselyTracker.java +++ b/parsely/src/main/java/com/parsely/parselyandroid/ParselyTracker.java @@ -60,7 +60,7 @@ public class ParselyTracker { private static int DEFAULT_FLUSH_INTERVAL_SECS = 60; private static int DEFAULT_ENGAGEMENT_INTERVAL_MILLIS = 10500; protected ArrayList> eventQueue; - private String siteId, rootUrl, storageKey, uuidKey, adKey; + private String siteId, rootUrl, storageKey, uuidKey; private boolean isDebug; private SharedPreferences settings; private int queueSizeLimit, storageSizeLimit; @@ -79,8 +79,8 @@ protected ParselyTracker(String siteId, int flushInterval, Context c) { this.siteId = siteId; this.uuidKey = "parsely-uuid"; - this.adKey = null; // get the adkey straight away on instantiation + this.deviceInfo = collectDeviceInfo(null); new GetAdKey(c).execute(); this.storageKey = "parsely-events.ser"; //this.rootUrl = "http://10.0.2.2:5001/"; // emulator localhost @@ -638,12 +638,12 @@ private String getSiteUuid() { * * Collects info about the device and user to use in Parsely events. */ - private Map collectDeviceInfo() { + private Map collectDeviceInfo(@Nullable final String adKey) { Map dInfo = new HashMap<>(); // TODO: screen dimensions (maybe?) - PLog("adkey is: %s, uuid is %s", this.adKey, this.getSiteUuid()); - String uuid = (this.adKey != null) ? this.adKey : this.getSiteUuid(); + PLog("adkey is: %s, uuid is %s", adKey, this.getSiteUuid()); + final String uuid = (adKey != null) ? adKey : this.getSiteUuid(); dInfo.put("parsely_site_uuid", uuid); dInfo.put("manufacturer", android.os.Build.MANUFACTURER); dInfo.put("os", "android"); @@ -755,9 +755,7 @@ protected String doInBackground(Void... params) { @Override protected void onPostExecute(String advertId) { - adKey = advertId; - deviceInfo = collectDeviceInfo(); - deviceInfo.put("parsely_site_uuid", adKey); + deviceInfo = collectDeviceInfo(advertId); } }