zhanghai vor 8 Jahren
Ursprung
Commit
38caa9b89e
1 geänderte Dateien mit 11 neuen und 11 gelöschten Zeilen
  1. 11 11
      app/src/main/java/com/sheep/gamegroup/statistics/AppStatistics.java

+ 11 - 11
app/src/main/java/com/sheep/gamegroup/statistics/AppStatistics.java

@@ -1,7 +1,8 @@
 package com.sheep.gamegroup.statistics;
 
+import android.text.TextUtils;
+
 import com.alibaba.fastjson.JSONObject;
-import com.googlecode.protobuf.format.util.TextUtils;
 import com.sheep.gamegroup.model.api.ApiService;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
@@ -48,26 +49,24 @@ public class AppStatistics {
      */
     synchronized public void sendDataToServer(int type,int subType,String subString){
         String openid = PreferenceUtils.getPrefString(SheepApp.mContext, UMConfigUtils.LOGIN_OPENID,"");
-        int uid = android.text.TextUtils.isEmpty(openid)?0:Integer.valueOf(openid);
+        //openid要转换成int类型
+        int uid = 0;
+        if(!TextUtils.isEmpty(openid)){
+            uid = Integer.parseInt(openid);
+        }
         String deviceId = DeviceUtil.getDeviceId(SheepApp.mContext);
         ApiService apiService =SheepApp.getInstance().getNetComponent().getApiService();
         JSONObject jsonObject = new JSONObject();
-        //openid要转换成int类型
         jsonObject.put("uid",uid);
         jsonObject.put("type",type);
         jsonObject.put("subtype",subType);
         jsonObject.put("substring",subString);
-//System.out.println("sendDataToServer --> " + jsonObject.toString());
         apiService.appEventTracking(jsonObject).subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new Subscriber<BaseMessage>() {
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.mContext) {
                     @Override
-                    public void onCompleted() {
-                    }
-
-                    @Override
-                    public void onError(Throwable throwable) {
-                        System.out.println("sendDataToServer onError-->>"+throwable.toString());
+                    public void onError(BaseMessage baseMessage) {
+                        System.out.println("sendDataToServer onError-->>"+baseMessage.toString());
                     }
 
                     @Override
@@ -76,4 +75,5 @@ public class AppStatistics {
                     }
                 });
     }
+
 }