示例#1
0
 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);
   }
 }
示例#2
0
 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);
 }
示例#3
0
 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.");
   }
 }
示例#4
0
 public String getName() {
   GAUsage.getInstance().setUsage(Field.GET_TRACKER_NAME);
   return this.mName;
 }