public void set(String key, String value) { GAUsage.getInstance().setUsage(Field.SET); if (value == null) { this.mParams.remove(key); } else { this.mParams.put(key, value); } }
public String get(String key) { GAUsage.getInstance().setUsage(Field.GET); if (TextUtils.isEmpty(key)) { return null; } if (this.mParams.containsKey(key)) { return (String) this.mParams.get(key); } if (key.equals(Fields.LANGUAGE)) { return Utils.getLanguage(Locale.getDefault()); } if (this.mClientIdDefaultProvider != null && this.mClientIdDefaultProvider.providesField(key)) { return this.mClientIdDefaultProvider.getValue(key); } if (this.mScreenResolutionDefaultProvider != null && this.mScreenResolutionDefaultProvider.providesField(key)) { return this.mScreenResolutionDefaultProvider.getValue(key); } if (this.mAppFieldsDefaultProvider == null || !this.mAppFieldsDefaultProvider.providesField(key)) { return null; } return this.mAppFieldsDefaultProvider.getValue(key); }
public void send(Map<String, String> params) { GAUsage.getInstance().setUsage(Field.SEND); Map<String, String> paramsToSend = new HashMap(); paramsToSend.putAll(this.mParams); if (params != null) { paramsToSend.putAll(params); } if (TextUtils.isEmpty((CharSequence) paramsToSend.get(Fields.TRACKING_ID))) { Log.w( String.format("Missing tracking id (%s) parameter.", new Object[] {Fields.TRACKING_ID})); } String hitType = (String) paramsToSend.get(Fields.HIT_TYPE); if (TextUtils.isEmpty(hitType)) { Log.w(String.format("Missing hit type (%s) parameter.", new Object[] {Fields.HIT_TYPE})); hitType = BuildConfig.FLAVOR; } if (hitType.equals(HitTypes.TRANSACTION) || hitType.equals(HitTypes.ITEM) || tokensAvailable()) { this.mHandler.sendHit(paramsToSend); } else { Log.w("Too many hits sent too quickly, rate limiting invoked."); } }
public String getName() { GAUsage.getInstance().setUsage(Field.GET_TRACKER_NAME); return this.mName; }