|
@@ -3,10 +3,13 @@ package com.sheep.gamegroup.util;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.sheep.gamegroup.statistics.AppStatistics;
|
|
import com.sheep.gamegroup.statistics.AppStatistics;
|
|
|
import com.sheep.gamegroup.statistics.AppStatisticsConfig;
|
|
import com.sheep.gamegroup.statistics.AppStatisticsConfig;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
-import com.umeng.analytics.MobclickAgent;
|
|
|
|
|
|
|
+//import com.umeng.analytics.MobclickAgent;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Created by zhanghai on 2018/3/30.
|
|
* Created by zhanghai on 2018/3/30.
|
|
@@ -81,6 +84,9 @@ public class UMConfigUtils {
|
|
|
public void onEvent(){
|
|
public void onEvent(){
|
|
|
UMConfigUtils.onEvent(this);
|
|
UMConfigUtils.onEvent(this);
|
|
|
}
|
|
}
|
|
|
|
|
+ public void onEvent(Map<String, String> map){
|
|
|
|
|
+ UMConfigUtils.onEvent(this, map);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static class Source{
|
|
public static class Source{
|
|
@@ -97,7 +103,8 @@ public class UMConfigUtils {
|
|
|
String source = PreferenceUtils.getPrefString(SheepApp.mContext,LOGIN_TYPE,Source.SHEEP);
|
|
String source = PreferenceUtils.getPrefString(SheepApp.mContext,LOGIN_TYPE,Source.SHEEP);
|
|
|
String openid = PreferenceUtils.getPrefString(SheepApp.mContext,LOGIN_OPENID,"");
|
|
String openid = PreferenceUtils.getPrefString(SheepApp.mContext,LOGIN_OPENID,"");
|
|
|
|
|
|
|
|
- MobclickAgent.onProfileSignIn(source,openid);
|
|
|
|
|
|
|
+// if(SheepApp.getInstance().getConnectAddress() != null && SheepApp.getInstance().getConnectAddress().isUseUMStatistics())
|
|
|
|
|
+// MobclickAgent.onProfileSignIn(source,openid);
|
|
|
|
|
|
|
|
//自己的统计信息
|
|
//自己的统计信息
|
|
|
AppStatistics.getInstance().sendDataToServer(AppStatisticsConfig.SuperType.DAU,AppStatisticsConfig.DauSubType.signIn,"");
|
|
AppStatistics.getInstance().sendDataToServer(AppStatisticsConfig.SuperType.DAU,AppStatisticsConfig.DauSubType.signIn,"");
|
|
@@ -107,7 +114,8 @@ public class UMConfigUtils {
|
|
|
* 登出
|
|
* 登出
|
|
|
*/
|
|
*/
|
|
|
public static void onProfileSignOff(){
|
|
public static void onProfileSignOff(){
|
|
|
- MobclickAgent.onProfileSignOff();
|
|
|
|
|
|
|
+// if(SheepApp.getInstance().getConnectAddress() != null && SheepApp.getInstance().getConnectAddress().isUseUMStatistics())
|
|
|
|
|
+// MobclickAgent.onProfileSignOff();
|
|
|
|
|
|
|
|
//自己的统计退出
|
|
//自己的统计退出
|
|
|
AppStatistics.getInstance().sendDataToServer(AppStatisticsConfig.SuperType.DAU,AppStatisticsConfig.DauSubType.signOff,"");
|
|
AppStatistics.getInstance().sendDataToServer(AppStatisticsConfig.SuperType.DAU,AppStatisticsConfig.DauSubType.signOff,"");
|
|
@@ -121,13 +129,28 @@ public class UMConfigUtils {
|
|
|
public static void onEvent(Event event){
|
|
public static void onEvent(Event event){
|
|
|
LogUtil.println("SheepApp onEvent "+event.getId()+" "+event.getKey());
|
|
LogUtil.println("SheepApp onEvent "+event.getId()+" "+event.getKey());
|
|
|
try{
|
|
try{
|
|
|
- MobclickAgent.onEvent(SheepApp.mContext,event.getKey());
|
|
|
|
|
|
|
+// if(SheepApp.getInstance().getConnectAddress() != null && SheepApp.getInstance().getConnectAddress().isUseUMStatistics())
|
|
|
|
|
+// MobclickAgent.onEvent(SheepApp.mContext,event.getKey());
|
|
|
|
|
|
|
|
AppStatistics.getInstance().sendDataToServer(AppStatisticsConfig.SuperType.ONCLICK_EVENT, event.getId(),"");
|
|
AppStatistics.getInstance().sendDataToServer(AppStatisticsConfig.SuperType.ONCLICK_EVENT, event.getId(),"");
|
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Umeng事件统计
|
|
|
|
|
+ * @param event
|
|
|
|
|
+ */
|
|
|
|
|
+ public static void onEvent(Event event, Map<String, String> map){
|
|
|
|
|
+ LogUtil.println("SheepApp onEvent "+event.getId()+" "+event.getKey());
|
|
|
|
|
+ try{
|
|
|
|
|
+// if(SheepApp.getInstance().getConnectAddress() != null && SheepApp.getInstance().getConnectAddress().isUseUMStatistics())
|
|
|
|
|
+// MobclickAgent.onEvent(SheepApp.mContext,event.getKey(), map);
|
|
|
|
|
|
|
|
|
|
+ AppStatistics.getInstance().sendDataToServer(AppStatisticsConfig.SuperType.ONCLICK_EVENT, event.getId(), JSON.toJSONString(map));
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -136,7 +159,8 @@ public class UMConfigUtils {
|
|
|
* @param context
|
|
* @param context
|
|
|
*/
|
|
*/
|
|
|
public static void onPageStart(Context context){
|
|
public static void onPageStart(Context context){
|
|
|
- MobclickAgent.onResume(context);
|
|
|
|
|
|
|
+// if(SheepApp.getInstance().getConnectAddress() != null && SheepApp.getInstance().getConnectAddress().isUseUMStatistics())
|
|
|
|
|
+// MobclickAgent.onResume(context);
|
|
|
|
|
|
|
|
String tag = context.getClass().getCanonicalName();
|
|
String tag = context.getClass().getCanonicalName();
|
|
|
AppStatistics.getInstance().sendDataToServer(AppStatisticsConfig.SuperType.PAGE_START,0,tag);
|
|
AppStatistics.getInstance().sendDataToServer(AppStatisticsConfig.SuperType.PAGE_START,0,tag);
|
|
@@ -147,7 +171,8 @@ public class UMConfigUtils {
|
|
|
* @param tag
|
|
* @param tag
|
|
|
*/
|
|
*/
|
|
|
public static void onPageStart(String tag){
|
|
public static void onPageStart(String tag){
|
|
|
- MobclickAgent.onPageStart(tag);
|
|
|
|
|
|
|
+// if(SheepApp.getInstance().getConnectAddress() != null && SheepApp.getInstance().getConnectAddress().isUseUMStatistics())
|
|
|
|
|
+// MobclickAgent.onPageStart(tag);
|
|
|
|
|
|
|
|
AppStatistics.getInstance().sendDataToServer(AppStatisticsConfig.SuperType.PAGE_START,0,tag);
|
|
AppStatistics.getInstance().sendDataToServer(AppStatisticsConfig.SuperType.PAGE_START,0,tag);
|
|
|
}
|
|
}
|
|
@@ -157,7 +182,8 @@ public class UMConfigUtils {
|
|
|
* @param context
|
|
* @param context
|
|
|
*/
|
|
*/
|
|
|
public static void onPageEnd(Context context){
|
|
public static void onPageEnd(Context context){
|
|
|
- MobclickAgent.onPause(context);
|
|
|
|
|
|
|
+// if(SheepApp.getInstance().getConnectAddress() != null && SheepApp.getInstance().getConnectAddress().isUseUMStatistics())
|
|
|
|
|
+// MobclickAgent.onPause(context);
|
|
|
|
|
|
|
|
String tag = context.getClass().getCanonicalName();
|
|
String tag = context.getClass().getCanonicalName();
|
|
|
AppStatistics.getInstance().sendDataToServer(AppStatisticsConfig.SuperType.PAGE_END,0,tag);
|
|
AppStatistics.getInstance().sendDataToServer(AppStatisticsConfig.SuperType.PAGE_END,0,tag);
|
|
@@ -168,7 +194,8 @@ public class UMConfigUtils {
|
|
|
* @param tag
|
|
* @param tag
|
|
|
*/
|
|
*/
|
|
|
public static void onPageEnd(String tag){
|
|
public static void onPageEnd(String tag){
|
|
|
- MobclickAgent.onPageEnd(tag);
|
|
|
|
|
|
|
+// if(SheepApp.getInstance().getConnectAddress() != null && SheepApp.getInstance().getConnectAddress().isUseUMStatistics())
|
|
|
|
|
+// MobclickAgent.onPageEnd(tag);
|
|
|
|
|
|
|
|
AppStatistics.getInstance().sendDataToServer(AppStatisticsConfig.SuperType.PAGE_END,0,tag);
|
|
AppStatistics.getInstance().sendDataToServer(AppStatisticsConfig.SuperType.PAGE_END,0,tag);
|
|
|
}
|
|
}
|