Merge pull request #2488 from natural-law/master

Update the umeng SDK
This commit is contained in:
minggo 2013-04-28 00:12:00 -07:00
commit e6d17a5be2
6 changed files with 283 additions and 260 deletions

View File

@ -62,6 +62,7 @@ void AnalyticsUmeng::startSession(const char* appKey)
return; return;
} }
NSString* pKey = [NSString stringWithUTF8String:appKey]; NSString* pKey = [NSString stringWithUTF8String:appKey];
[[MobClick class] performSelector:@selector(setWrapperType:wrapperVersion:) withObject:@"Cocos2d-x" withObject:@"1.0"];
[MobClick startWithAppkey:pKey]; [MobClick startWithAppkey:pKey];
} }
@ -311,6 +312,7 @@ void AnalyticsUmeng::startSession(const char* appKey, UmengReportPolicy policy,
NSString* key = [NSString stringWithUTF8String:appKey]; NSString* key = [NSString stringWithUTF8String:appKey];
NSString* channel = [NSString stringWithUTF8String:channelId]; NSString* channel = [NSString stringWithUTF8String:channelId];
[[MobClick class] performSelector:@selector(setWrapperType:wrapperVersion:) withObject:@"Cocos2d-x" withObject:@"1.0"];
[MobClick startWithAppkey:key reportPolicy:(ReportPolicy)policy channelId:channel]; [MobClick startWithAppkey:key reportPolicy:(ReportPolicy)policy channelId:channel];
} }

View File

@ -3,348 +3,349 @@
// MobClick // MobClick
// //
// Created by Aladdin on 2010-03-25. // Created by Aladdin on 2010-03-25.
// Updated by Minghua on 2012-09-11. // Updated by Minghua on 2013-04-01.
// Copyright 2010-2012 Umeng.com . All rights reserved. // Copyright 2010-2012 Umeng.com . All rights reserved.
// Version 2.1.0 , updated_at 2012-09-11. // Version 2.2.0.OpenUDID, updated_at 2013-04-01.
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#define UMOnlineConfigDidFinishedNotification @"OnlineConfigDidFinishedNotification" #define UMOnlineConfigDidFinishedNotification @"OnlineConfigDidFinishedNotification"
#define XcodeAppVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]
typedef enum { typedef enum {
REALTIME = 0, //实时发送 REALTIME = 0, //实时发送
BATCH = 1, //启动发送 BATCH = 1, //启动发送
SENDDAILY = 4, //每日发送 SENDDAILY = 4, //每日发送
SENDWIFIONLY = 5 //仅在WIFI下启动时发送 SENDWIFIONLY = 5, //仅在WIFI下启动时发送
SEND_INTERVAL = 6, //按最小间隔发送
SEND_ON_EXIT = 7 //退出或进入后台时发送
} ReportPolicy; } ReportPolicy;
@protocol MobClickDelegate; @protocol MobClickDelegate;
@class CLLocation; @class CLLocation;
/** MobClick是统计的核心类本身不需要实例化所有方法以类方法的形式提供.
REALTIME,BATCH,SENDDAILY,SENDWIFIONLY,SEND_INTERVAL,SEND_ON_EXIT
REALTIME,SENDWIFIONLY DEBUG模式下生效release模式会自动改成BATCH
http://blog.umeng.com/index.php/2012/12/0601/
SEND_INTERVAL ,10,10 86400() 10
SEND_ON_EXIT 退,App运行过程中不发送
iOS > 4.0, iOS < 4.0 BATCH
*/
@interface MobClick : NSObject <UIAlertViewDelegate> { @interface MobClick : NSObject <UIAlertViewDelegate> {
@private @private
id _internal; id _internal;
} }
#pragma mark basics #pragma mark basics
//开启友盟统计,以BATCH方式发送log.
+ (void)startWithAppkey:(NSString *)appKey;
// channelId 为nil或@""时,默认会被被当作@"App Store"渠道
+ (void)startWithAppkey:(NSString *)appKey reportPolicy:(ReportPolicy)rp channelId:(NSString *)cid;
/* ///---------------------------------------------------------------------------------------
app版本信息CFBundleVersion里取,build version,xcode3工程兼容. /// @name 设置
xcode4版本保持一致使 ///---------------------------------------------------------------------------------------
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
[MobClick setAppVersion:version]; /** 设置app版本号。由于历史原因需要和xcode3工程兼容,友盟提取的是Build号(CFBundleVersion),如果需要和App Store上的版本一致,需要调用此方法。
*/
@param appVersion `XcodeAppVersion`.
@return void.
*/
+ (void)setAppVersion:(NSString *)appVersion; + (void)setAppVersion:(NSString *)appVersion;
+ (NSString *)getAgentVersion; //获取友盟sdk 版本号
/*方法名:
* setCrashReportEnabled:(BOOL)value /** 开启CrashReport收集, 默认是开启状态.
*:
* umeng SDK crash log @param value NO,CrashReport收集.
*: @return void.
* (BOOL)value:YES */
* NO,umeng SDK crash log,setDelegate方法之前调用
*/
+ (void)setCrashReportEnabled:(BOOL)value; + (void)setCrashReportEnabled:(BOOL)value;
/*方法名:
* setLogEnabled:(BOOL)value
*: /** 设置是否打印sdk的log信息,默认不开启
* sdk的log信息 @param value YES,umeng SDK log信息,release产品时要设置回NO.
*: @return .
* (BOOL)value:NO @exception .
* YES,umeng SDK log信息,release产品时要设置回NO
*/ */
+ (void)setLogEnabled:(BOOL)value; + (void)setLogEnabled:(BOOL)value;
/*方法名:
* logPageView:seconds: ///---------------------------------------------------------------------------------------
*: /// @name 开启统计
* view打开多长时间. ///---------------------------------------------------------------------------------------
*
*:
* pageName NSString * /** 开启友盟统计,默认以BATCH方式发送log.
* seconds int型
* @param appKey appKey.
* @param reportPolicy .
* @param channelId ,nil或@"",@"App Store"
*: @return void
* */
* + (void)startWithAppkey:(NSString *)appKey;
*: http://dev.umeng.com/doc/document_ana_ios.html#8 + (void)startWithAppkey:(NSString *)appKey reportPolicy:(ReportPolicy)rp channelId:(NSString *)cid;
*/
/** 当reportPolicy == SEND_INTERVAL 时设定log发送间隔
@param second ,10,86400().
@return void.
*/
+ (void)setLogSendInterval:(double)second;
///---------------------------------------------------------------------------------------
/// @name 页面计时
///---------------------------------------------------------------------------------------
/** 页面时长统计,记录某个view被打开多长时间,可以自己计时也可以调用beginLogPageView,endLogPageView自动计时
@param pageName view名称.
@param seconds int型.
@return void.
*/
+ (void)logPageView:(NSString *)pageName seconds:(int)seconds; + (void)logPageView:(NSString *)pageName seconds:(int)seconds;
+ (void)beginLogPageView:(NSString *)pageName; + (void)beginLogPageView:(NSString *)pageName;
+ (void)endLogPageView:(NSString *)pageName; + (void)endLogPageView:(NSString *)pageName;
#pragma mark event logs #pragma mark event logs
/*方法名:
* event:(NSString *)eventId
* event:(NSString *)eventId label:(NSString *)label
* event:(NSString *)eventId acc:(NSInteger)accumulation
* event:(NSString *)eventId label:(NSString *)label acc:(NSInteger)accumulation
*:
* 使App管理后台的设置-> IDID即可
*
*:
* 便1
* label:ID添加该事件的分类标签统计ID进行统计和整理ID的不同的标签便
* accumulation:ID的某一分类标签进行累加
*
*: http://dev.umeng.com/doc/document_ana_ios.html#3
*/
//如果label为nil或@""时服务器端会生成一个unknown的默认label,
//为避免这种情况,2.0.0之后label为nil或@""时,label将被赋值为eventId ///---------------------------------------------------------------------------------------
//详细文档参见 iOS统计分析SDK开发指南.html 或在线文档 /// @name 事件统计
//http://dev.umeng.com/doc/document_ana_ios.html#3 ///---------------------------------------------------------------------------------------
/** 自定义事件,数量统计.
使App管理后台的设置-> IDID
@param eventId Id.
@param label 便,nil或空字符串时后台会生成和eventId同名的标签.
@param accumulation ID的某一分类标签进行累加
@return void.
*/
+ (void)event:(NSString *)eventId; //等同于 event:eventId label:eventId; + (void)event:(NSString *)eventId; //等同于 event:eventId label:eventId;
/** 自定义事件,数量统计.
使App管理后台的设置-> IDID
*/
+ (void)event:(NSString *)eventId label:(NSString *)label; // label为nil或@""时,等同于 event:eventId label:eventId; + (void)event:(NSString *)eventId label:(NSString *)label; // label为nil或@""时,等同于 event:eventId label:eventId;
/** 自定义事件,数量统计.
使App管理后台的设置-> IDID
*/
+ (void)event:(NSString *)eventId acc:(NSInteger)accumulation; + (void)event:(NSString *)eventId acc:(NSInteger)accumulation;
/** 自定义事件,数量统计.
使App管理后台的设置-> IDID
*/
+ (void)event:(NSString *)eventId label:(NSString *)label acc:(NSInteger)accumulation; + (void)event:(NSString *)eventId label:(NSString *)label acc:(NSInteger)accumulation;
/** 自定义事件,数量统计.
使App管理后台的设置-> IDID
*/
+ (void)event:(NSString *)eventId attributes:(NSDictionary *)attributes; + (void)event:(NSString *)eventId attributes:(NSDictionary *)attributes;
/** 自定义事件,时长统计.
使App管理后台的设置-> IDID.
beginEvent,endEvent要配对使用,durations参数传递进来
@param eventId Id.
@param label 便,nil或空字符串时后台会生成和eventId同名的标签.
@param primarykey event_id一起标示一个唯一事件beginEvent和endEvent eventId primarykey
@param millisecond
@return void.
@warning event的attributes不能超过10个
eventIdattributes中key和value都不能使用空格和特殊字符eventIdattributes的key最大为128个bytes(12842)labelattributes的value最大为256个bytes(25684),
eventId超过的将抛弃不再发送
id ts du是保留字段eventId及key的名称
*/
+ (void)beginEvent:(NSString *)eventId; + (void)beginEvent:(NSString *)eventId;
/** 自定义事件,时长统计.
使App管理后台的设置-> IDID.
*/
+ (void)endEvent:(NSString *)eventId; + (void)endEvent:(NSString *)eventId;
/** 自定义事件,时长统计.
使App管理后台的设置-> IDID.
*/
+ (void)beginEvent:(NSString *)eventId label:(NSString *)label; + (void)beginEvent:(NSString *)eventId label:(NSString *)label;
/** 自定义事件,时长统计.
使App管理后台的设置-> IDID.
*/
+ (void)endEvent:(NSString *)eventId label:(NSString *)label; + (void)endEvent:(NSString *)eventId label:(NSString *)label;
/** 自定义事件,时长统计.
使App管理后台的设置-> IDID.
*/
//primarykey这个参数用于和event_id一起标示一个唯一事件并不会被统计
//对于同一个事件在beginEvent和endEvent 中要传递相同的eventId 和 primarykey
//每个event的attributes不能超过10个
//eventId、attributes中key和value都不能使用空格和特殊字符且长度不能超过255个字符否则将截取前255个字符
//id ts du是保留字段不能作为eventId及key的名称
+ (void)beginEvent:(NSString *)eventId primarykey :(NSString *)keyName attributes:(NSDictionary *)attributes; + (void)beginEvent:(NSString *)eventId primarykey :(NSString *)keyName attributes:(NSDictionary *)attributes;
/** 自定义事件,时长统计.
使App管理后台的设置-> IDID.
*/
+ (void)endEvent:(NSString *)eventId primarykey:(NSString *)keyName; + (void)endEvent:(NSString *)eventId primarykey:(NSString *)keyName;
/** 自定义事件,时长统计.
//时间单位为毫秒 microseconds 使App管理后台的设置-> IDID.
+ (void)event:(NSString *)eventId durations:(int)microseconds;
+ (void)event:(NSString *)eventId label:(NSString *)label durations:(int)microseconds;
+ (void)event:(NSString *)eventId attributes:(NSDictionary *)attributes durations:(int)microseconds;
#pragma mark feedback Default GUI
/*方法名:
- * showFeedback:(UIViewController *)rootViewcontroller
- *:
- *
- *:
- * rootViewController:presentModalViewController方法来展示反馈界面
- * rootViewController非空
- *
- * 使SDK
- */
+ (void)showFeedback:(UIViewController *)rootViewController;
#pragma mark feedback data api
/*方法名:
* feedbackWithDictionary:(NSDictionary * )feedbackDict
*:
*
*:
* Dictionary中应该有以下三个键名:
* @"UMengFeedbackGender" @"UMengFeedbackAge" @"UMengFeedbackContent"
* :
* NSString类型的
* 1=> 2=>
*
* 1=>18(18),2=>18-24,3=>25-30,
* 4=>31-35,5=>36-40,6=>41-50,7=>51-59,8=>6060
*
*
*
*:
*
*
*
* 使SDK
*/ */
+ (void)feedbackWithDictionary:(NSDictionary *)feedbackDict;
+ (void)event:(NSString *)eventId durations:(int)millisecond;
#pragma mark check app update /** 自定义事件,时长统计.
/*方法名: 使App管理后台的设置-> IDID.
* checkUpdate
* checkUpdateWithTitle:CancelButtonTitle:OtherButtonTitle:
*:
* app是否有更新UIAlertView提示用户,app会跳转到您预先设置的网址
*
* app版本信息App Store.
* checkUpdate .
*
*:
* checkUpdate
* checkUpdate:cancelButtonTitle:otherButtonTitles: :
* title UIAlertView的title
* cancelTitle UIAlertView的cancelTitle
* otherTitle UIAlertView的otherTitle
*
* [MobClick setDelegate:reportPolicy:];
* MobClickDelegate的appUpdate方法
*
*:
*
*
*: http://dev.umeng.com/doc/document_ana_ios.html#5
*/ */
+ (void)event:(NSString *)eventId label:(NSString *)label durations:(int)millisecond;
/** 自定义事件,时长统计.
使App管理后台的设置-> IDID.
*/
+ (void)event:(NSString *)eventId attributes:(NSDictionary *)attributes durations:(int)millisecond;
///---------------------------------------------------------------------------------------
/// @name 按渠道自动更新
///---------------------------------------------------------------------------------------
/** 按渠道自动更新检测
app是否有更新UIAlertView提示用户,app会跳转到您预先设置的网址
app版本信息App Store.
MobClickDelegate的appUpdate方法
@param title UIAlertView的title.
@param cancelTitle UIAlertView的cancelTitle.
@param otherTitle UIAlertView的otherTitle.
@param delegate checkUpdate的对象.
@param callBackSelectorWithDictionary checkUpdate事件完成时此方法会被调用,app更新信息的字典被传回.
@return void.
*/
+ (void)checkUpdate; + (void)checkUpdate;
/** 按渠道自动更新检测
*/
+ (void)checkUpdate:(NSString *)title cancelButtonTitle:(NSString *)cancelTitle otherButtonTitles:(NSString *)otherTitle; + (void)checkUpdate:(NSString *)title cancelButtonTitle:(NSString *)cancelTitle otherButtonTitles:(NSString *)otherTitle;
/** 按渠道自动更新检测
*/
+ (void)checkUpdateWithDelegate:(id)delegate selector:(SEL)callBackSelectorWithDictionary; + (void)checkUpdateWithDelegate:(id)delegate selector:(SEL)callBackSelectorWithDictionary;
#pragma mark online config params ///---------------------------------------------------------------------------------------
/*方法名: /// @name 在线参数
* updateOnlineConfig ///---------------------------------------------------------------------------------------
*:
* 线,[NSUserDefaults standardUserDefaults].
* 线SDK端发送策略的功能 /** 使用在线参数功能,可以让你动态修改应用中的参数值,
* 线. 线,[NSUserDefaults standardUserDefaults],
* 线SDK端发送策略的功能,线.
*: [MobClick startWithAppkey:];
* 线UMOnlineConfigDidFinishedNotification
* @param .
* [MobClick setDelegate:reportPolicy:]; @return void.
* 使线
*
*:
*
*
*: http://dev.umeng.com/doc/document_ana_ios.html#6
*/ */
+ (void)updateOnlineConfig; + (void)updateOnlineConfig;
/*方法名: /** 从[NSUserDefaults standardUserDefaults]获取缓存的在线参数的数值
* getConfigParams key的值线.
* getConfigParams: updateOnlineConfig才能使用,线UMOnlineConfigDidFinishedNotification
*:
* [NSUserDefaults standardUserDefaults]线. @param key
* key的值线. @return (NSString *) .
*
*:
* NSString *
*
* [NSUserDefaults standardUserDefaults],
* updateOnlineConfig方法要先在app启动时被调用
*
*:
* (NSString *) (NSDictionary *)
*
*: http://dev.umeng.com/doc/document_ana_ios.html#6
*/ */
+ (NSString *)getConfigParams:(NSString *)key; + (NSString *)getConfigParams:(NSString *)key;
/** 从[NSUserDefaults standardUserDefaults]获取缓存的在线参数
@return (NSDictionary *).
*/
+ (NSDictionary *)getConfigParams; + (NSDictionary *)getConfigParams;
// 为了更精确的统计用户地理位置,可以调用此方法传入经纬度信息
// 需要链接 CoreLocation.framework 并且 #import <CoreLocation/CoreLocation.h> ///---------------------------------------------------------------------------------------
/// @name 地理位置设置
///---------------------------------------------------------------------------------------
/** 为了更精确的统计用户地理位置,可以调用此方法传入经纬度信息
CoreLocation.framework #import <CoreLocation/CoreLocation.h>
@param latitude .
@param longitude .
@param location CLLocation *
@return void
*/
+ (void)setLatitude:(double)latitude longitude:(double)longitude; + (void)setLatitude:(double)latitude longitude:(double)longitude;
/** 为了更精确的统计用户地理位置,可以调用此方法传入经纬度信息
*/
+ (void)setLocation:(CLLocation *)location; + (void)setLocation:(CLLocation *)location;
#pragma mark helper ///---------------------------------------------------------------------------------------
/*方法名: /// @name helper方法
* isJailbroken ///---------------------------------------------------------------------------------------
*:
* apt和Cydia.app的path来判断
*:
*
*
*
*/
#pragma mark utils api
// 类方法,判断当前设备是否已经越狱 /** 判断设备是否越狱,判断方法根据 apt和Cydia.app的path来判断
*/
+ (BOOL)isJailbroken; + (BOOL)isJailbroken;
// 类方法判断你的App是否被破解 /** 判断你的App是否被破解
*/
+ (BOOL)isPirated; + (BOOL)isPirated;
#pragma mark DEPRECATED methods from version 1.7 #pragma mark DEPRECATED methods from version 1.7
/*方法名:
* setDelegate:(id<MobClickDelegate>)delegate
* setDelegate:(id<MobClickDelegate>)delegate reportPolicy:(ReportPolicy)rp; /** 设置MobClick代理,已经startWithAppkey:所取代,不要再使用,原有代码可以删除
*: */
* startWithAppkey:(NSString *)appKey ;
* MobClickDelegate实现使.
* MobClick代理MobClick实例appLaunched方法前
*:
* delegate:MobClickDelegate协议的实例
* ReportPolicy:
* 1.BATCH :
* 2.REALTIME :event
*
*/
+ (void)setDelegate:(id)delegate; + (void)setDelegate:(id)delegate;
+ (void)setDelegate:(id)delegate reportPolicy:(ReportPolicy)rp; + (void)setDelegate:(id)delegate reportPolicy:(ReportPolicy)rp;
/*方法名: /** 记录启动时间,模块开始启用,不要再使用,原有代码可以删除
* appLaunched */
*:
* setDelegate: setDelegate: reportPolicy:
*:
*
*
* 1.6.7.
*/
+ (void)appLaunched; + (void)appLaunched;
/*方法名:
* appTerminated /** 记录软件终止时间,模块终止,不要再使用,原有代码可以删除
*:
*
*:
*
* 1.6.7.
*/ */
+ (void)appTerminated; + (void)appTerminated;
/* /** 友盟模块启动
SDK内部使用的监听方法App启动退 [MobClick startWithAppkey:]application:didFinishLaunchingWithOptions:
App启动和退出事件application:didFinishLaunchingWithOptions:[MobClick startWithAppkey:]
[MobClick startWithAppkey:]application:didFinishLaunchingWithOptions: App的启动事件可能会无法监听[MobClick startSession:nil]session
App启动和退出事件application:didFinishLaunchingWithOptions:[MobClick startWithAppkey:] app里app使用不到.
App的启动事件可能会无法监听[MobClick startSession:nil]session
*/ */
+ (void)startSession:(NSNotification *)notification; + (void)startSession:(NSNotification *)notification;
/** 获取友盟sdk 版本号,目前友盟模块启动时自动调用,不要再使用,原有代码可以删除
*/
+ (NSString *)getAgentVersion; //
@end @end
//此协议的三个方法不再建议使用,建议用新方法代替 /** MobClickDelegate protocol
//+ (void)startWithAppkey:(NSString *)appKey reportPolicy:(ReportPolicy)rp channelId:(NSString *)cid; 使
//+ (void)checkUpdate:(id)delegate selector:(SEL)callBackSelector; + (void)startWithAppkey:(NSString *)appKey reportPolicy:(ReportPolicy)rp channelId:(NSString *)cid;
+ (void)checkUpdate:(id)delegate selector:(SEL)callBackSelector;
*/
@protocol MobClickDelegate <NSObject> @protocol MobClickDelegate <NSObject>
@optional @optional
/*方法名:
* - (NSString *)appKey;
*:
* AppkeyAppkey错误log进行记录
*:
* Appkey是从友盟后台注册新App得到的
*
*/
- (NSString *)appKey; - (NSString *)appKey;
/*方法名:
* - (NSString *)channelId;
*:
* ChannelID
*:
* @"Apple Store",@"产品主页"
* 使
*
*/
- (NSString *)channelId; - (NSString *)channelId;
/*方法名:
* - (void)appUpdate:(NSMutableDictionary *)updateInfo;
*:
*
*:
* [MobClick checkUpdate]appUpdate
* updateInfo是与此app版本信息相关的参数
*
*
*
*/
- (void)appUpdate:(NSDictionary *)appUpdateInfo; - (void)appUpdate:(NSDictionary *)appUpdateInfo;
@end @end

View File

@ -1 +1 @@
bf891cff30d0a838748b877ec96cded1e540e349 c61504f40c4fbe912ff1d74677edf29234eb192c

View File

@ -0,0 +1 @@
ac5e2e30a4c3ff07611e9c6260eaff84bf644135

View File

@ -23,7 +23,10 @@ THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
package org.cocos2dx.plugin; package org.cocos2dx.plugin;
import java.util.HashMap;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Iterator;
import android.content.Context; import android.content.Context;
import android.util.Log; import android.util.Log;
@ -49,6 +52,7 @@ public class AnalyticsUmeng implements InterfaceAnalytics{
public AnalyticsUmeng(Context context) { public AnalyticsUmeng(Context context) {
mContext = context; mContext = context;
MobclickAgent.setWrapper("Cocos2d-x", "1.0");
} }
public boolean isValid() { public boolean isValid() {
@ -101,7 +105,8 @@ public class AnalyticsUmeng implements InterfaceAnalytics{
@Override @Override
public void logEvent(String eventId, Hashtable<String, String> paramMap) { public void logEvent(String eventId, Hashtable<String, String> paramMap) {
LogD("logEvent(eventId, paramMap) invoked!"); LogD("logEvent(eventId, paramMap) invoked!");
MobclickAgent.onEvent(mContext, eventId, paramMap); HashMap<String, String> curParam = changeTableToMap(paramMap);
MobclickAgent.onEvent(mContext, eventId, curParam);
} }
@Override @Override
@ -188,7 +193,8 @@ public class AnalyticsUmeng implements InterfaceAnalytics{
LogD("logEventWithDuration(eventId, duration, paramMap) invoked!"); LogD("logEventWithDuration(eventId, duration, paramMap) invoked!");
if (!isValid()) return; if (!isValid()) return;
try{ try{
MobclickAgent.onEventDuration(mContext, eventId, paramMap, duration); HashMap<String, String> curMap = changeTableToMap(paramMap);
MobclickAgent.onEventDuration(mContext, eventId, curMap, duration);
} catch(Exception e){ } catch(Exception e){
LogE("Exception in logEventWithDuration,eventId,duration,paramMap", e); LogE("Exception in logEventWithDuration,eventId,duration,paramMap", e);
} }
@ -218,7 +224,8 @@ public class AnalyticsUmeng implements InterfaceAnalytics{
LogD("logTimedKVEventBegin invoked!"); LogD("logTimedKVEventBegin invoked!");
if (!isValid()) return; if (!isValid()) return;
try{ try{
MobclickAgent.onKVEventBegin(mContext, eventId, paramMap, label); HashMap<String, String> curMap = changeTableToMap(paramMap);
MobclickAgent.onKVEventBegin(mContext, eventId, curMap, label);
} catch(Exception e){ } catch(Exception e){
LogE("Exception in logTimedKVEventBegin", e); LogE("Exception in logTimedKVEventBegin", e);
} }
@ -233,4 +240,16 @@ public class AnalyticsUmeng implements InterfaceAnalytics{
LogE("Exception in logTimedKVEventEnd", e); LogE("Exception in logTimedKVEventEnd", e);
} }
} }
private HashMap<String, String> changeTableToMap(Hashtable<String, String> param) {
HashMap<String, String> retParam = new HashMap<String, String>();
for(Iterator<String> it = param.keySet().iterator(); it.hasNext(); ) {
String key = it.next();
String value = param.get(key);
retParam.put(key, value);
}
return retParam;
}
} }