#include #include #include "jni/JniHelper.h" #include #include using namespace std; using namespace cocos2d; string getIPAddress() { JniMethodInfo t; string IPAddress(""); if (JniHelper::getStaticMethodInfo(t, "org/cocos2dx/lua/AppActivity", "getLocalIpAddress", "()Ljava/lang/String;")) { jstring str = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID); t.env->DeleteLocalRef(t.classID); IPAddress = JniHelper::jstring2string(str); t.env->DeleteLocalRef(str); } return IPAddress; }