Skip to content

Commit

Permalink
Update the umeng SDK to new version.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangbin committed Apr 28, 2013
1 parent 967949c commit 5124688
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
Binary file modified plugin/plugins/umeng/proj.android/sdk/umeng_sdk.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ of this software and associated documentation files (the "Software"), to deal
****************************************************************************/
package org.cocos2dx.plugin;

import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;

import android.content.Context;
import android.util.Log;

Expand All @@ -49,6 +52,7 @@ protected static void LogD(String msg) {

public AnalyticsUmeng(Context context) {
mContext = context;
MobclickAgent.setWrapper("Cocos2d-x", "1.0");
}

public boolean isValid() {
Expand Down Expand Up @@ -101,7 +105,8 @@ public void logEvent(String eventId) {
@Override
public void logEvent(String eventId, Hashtable<String, String> paramMap) {
LogD("logEvent(eventId, paramMap) invoked!");
MobclickAgent.onEvent(mContext, eventId, paramMap);
HashMap<String, String> curParam = changeTableToMap(paramMap);
MobclickAgent.onEvent(mContext, eventId, curParam);
}

@Override
Expand Down Expand Up @@ -188,7 +193,8 @@ protected void logEventWithDuration(String eventId, int duration, Hashtable<Stri
LogD("logEventWithDuration(eventId, duration, paramMap) invoked!");
if (!isValid()) return;
try{
MobclickAgent.onEventDuration(mContext, eventId, paramMap, duration);
HashMap<String, String> curMap = changeTableToMap(paramMap);
MobclickAgent.onEventDuration(mContext, eventId, curMap, duration);
} catch(Exception e){
LogE("Exception in logEventWithDuration,eventId,duration,paramMap", e);
}
Expand Down Expand Up @@ -218,7 +224,8 @@ protected void logTimedKVEventBegin(String eventId, String label, Hashtable<Stri
LogD("logTimedKVEventBegin invoked!");
if (!isValid()) return;
try{
MobclickAgent.onKVEventBegin(mContext, eventId, paramMap, label);
HashMap<String, String> curMap = changeTableToMap(paramMap);
MobclickAgent.onKVEventBegin(mContext, eventId, curMap, label);
} catch(Exception e){
LogE("Exception in logTimedKVEventBegin", e);
}
Expand All @@ -233,4 +240,16 @@ protected void logTimedKVEventEnd(String eventId, String label) {
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;
}
}

0 comments on commit 5124688

Please sign in to comment.