Kaynağa Gözat

修改统计

zhanghai 8 yıl önce
ebeveyn
işleme
450ba5feef

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

@@ -11,6 +11,7 @@ import com.sheep.gamegroup.util.PreferenceUtils;
 import com.sheep.gamegroup.util.UMConfigUtils;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 
+import rx.Subscriber;
 import rx.android.schedulers.AndroidSchedulers;
 import rx.schedulers.Schedulers;
 
@@ -45,7 +46,7 @@ public class AppStatistics {
      *
      * @param subString
      */
-    public void sendDataToServer(int type,int subType,String subString){
+    synchronized public void sendDataToServer(int type,int subType,String subString){
         String openid = PreferenceUtils.getPrefString(SheepApp.mContext, UMConfigUtils.LOGIN_OPENID,"");
 
         String deviceId = DeviceUtil.getDeviceId(SheepApp.mContext);
@@ -56,13 +57,17 @@ public class AppStatistics {
         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 SheepSubscriber<BaseMessage>(SheepApp.mContext) {
+                .subscribe(new Subscriber<BaseMessage>() {
+                    @Override
+                    public void onCompleted() {
+                    }
+
                     @Override
-                    public void onError(BaseMessage baseMessage) {
-                        System.out.println("sendDataToServer onError");
+                    public void onError(Throwable throwable) {
+                        System.out.println("sendDataToServer onError-->>"+throwable.toString());
                     }
 
                     @Override