@asce1885
2015-08-12T10:03:44.000000Z
字数 3082
阅读 498
Android
本次调研主要对三款主流的统计SDK进行:TaklingData,友盟,百度。
//如果不想在AndroidManifest里的meta-data申明了TD_APP_ID,请调用:
init(final Context context, final String appId, final String partnerid)
//如果已经在AndroidManifest里的meta-data申明了TD_APP_ID,请调用:
init(final Context context)
@Override
protect void onResume() {
super.onResume();
TCAgent.onResume(this);
}
@Override
protect void onPause() {
super.onPause();
TCAgent.onPause(this);
}
TCAgent.onPageStart(Context ctx, String pageName);
TCAgent.onPageEnd(Context ctx, String pageName);
TCAgent.onEvent(Context ctx, String EVENT_ID);
TCAgent.onEvent(Context ctx, String EVENT_ID, String EVENT_LABEL);
TCAgent.onEvent(Context ctx, String EVENT_ID, String EVENT_LABEL, Map<string, object=""> kv);
TCAgent.setGlobalKV(String key, Object value);
TCAgent.removeGlobalKV(String key);
TCAgent.setReportUncaughtExceptions(Boolean enabled)
TCAgent.onError(Activity activity, Throwable throwable)
public void onResume() {
super.onResume();
MobclickAgent.onResume(this);
}
public void onPause() {
super.onPause();
MobclickAgent.onPause(this);
}
public void onResume() {
super.onResume();
MobclickAgent.onPageStart("SplashScreen"); //统计页面(仅有Activity的应用中SDK自动调用,不需要单独写)
MobclickAgent.onResume(this); //统计时长
}
public void onPause() {
super.onPause();
MobclickAgent.onPageEnd("SplashScreen"); // (仅有Activity的应用中SDK自动调用,不需要单独写)保证 onPageEnd 在onPause 之前调用,因为 onPause 中会保存信息
MobclickAgent.onPause(this);
}
MobclickAgent.onEvent(Context context, String eventId);
MobclickAgent.onEvent(Context context, String eventId, HashMap<String,String> map);
public static void reportError(Context context, String error)
//或
public static void reportError(Context context, Throwable e)
public void onResume() {
super.onResume();
/**
* 页面起始(每个Activity中都需要添加,如果有继承的父Activity中已经添加了该调用,那么子Activity中务必不能添加)
* 不能与StatService.onPageStart以及onPageEnd函数交叉使用
*/
StatService.onResume(this);
}
public void onPause() {
super.onPause();
/**
* 页面结束(每个Activity中都需要添加,如果有继承的父Activity中已经添加了该调用,那么子Activity中务必不能添加)
* 不能与StatService.onPageStart以及onPageEnd函数交叉使用
*/
StatService.onPause(this);
}
@Override
public void onResume() {
super.onResume();
StatService.onResume(this);
}
@Override
public void onPause() {
super.onPause();
StatService.onPause(this);
}
public void onResume() {
Log.w(Conf.TAG, "DemoDialogActivity.OnResume()");
super.onResume();
/**
* 页面起始(每个Activity中都需要添加,如果有继承的父Activity中已经添加了该调用,那么子Activity中务必不能添加)
* 与StatService.onResume(this)类似;
*/
StatService.onPageStart(this, "DemoDialogActivityp");//(this);
}
public void onPause() {
Log.w(Conf.TAG, "DemoDialogActivity.onPause()");
super.onPause();
/**
* 页面结束(每个Activity中都需要添加,如果有继承的父Activity中已经添加了该调用,那么子Activity中务必不能添加)
* 与StatService.onPause(this)类似;
*/
StatService.onPageEnd(this, "DemoDialogActivityp");//(this);
}
void onEvent(Context context, String event_id, String label)
void onEvent(Context context, String event_id, String label, int acc)
void onEventStart(Context context, String event_id, String label)
void onEventEnd(Context context, String event_id, String label)
void onEventDuration(Context context, String event_id, String label, int milliseconds)