mirror of https://github.com/axmolengine/axmol.git
22 lines
588 B
C++
22 lines
588 B
C++
|
#include <jni.h>
|
||
|
#include <android/log.h>
|
||
|
#include "jni/JniHelper.h"
|
||
|
#include <string>
|
||
|
#include <vector>
|
||
|
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;
|
||
|
}
|