How to use plugin-x in cocos2d-x JSB 2.2.3?
so do I. I create new project. And write
var pluginManager = plugin.PluginManager.getInstance();
this.PluginIAP = pluginManager.loadPlugin("AnalyticsUmeng");
this.PluginIAP.setListener(this);
and the console said: plugin not defined…
My JSB version is 3.0 RC.
please help me
simply call java from javascript using jsb.reflection : How we can open a link click on a button in cocos2d-x javascirt
and before this simply write the java code for the plugin:
http://www.cocos2d-x.org/wiki/How_to_Integrate_a_3rd_party_SDK_into_Plugin-X
// Java code in plugin, the method of plugin implement like this:
protected void logEventWithDuration(JSONObject eventInfo) {
LogD("logEventWithDuration invoked! event : " + eventInfo.toString());
if (!isValid()) return;
try{
String eventId = eventInfo.getString("Param1"); // get param eventID by key "Param1"
int duration = eventInfo.getInt("Param2"); // get param duration by key "Param2"
MobclickAgent.onEventDuration(mContext, eventId, duration);
} catch(Exception e){
LogE("Exception in logEventWithDuration", e);
}
}
DO NOT USE JSONObject INPUT PARAM TYPE, FIRST READ THE DOCS ABOUT JSP.REFLECTION
https://github.com/chukong/cocos-docs/blob/master/manual/framework/html5/v3/reflection/en.md
OR
go trough this tutorial: