extern "C" { #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) void Java_com_friendou_Interface_coralsdk_SendtoGame(JNIEnv *env, jobject thiz, jstring info) { const char *temp = env->GetStringUTFChars(info, NULL); if (gSDKCallback == NULL || p != NULL) { __android_log_print(ANDROID_LOG_INFO,"SDKCallbackError","The gSDKCallback pointer is null !"); return; } FMJSONDictionary *Recivejson = new FMJSONDictionary(); Recivejson->initWithDescription(temp);// __android_log_print(ANDROID_LOG_INFO,"SDKCallback","SDKCallback message = %s", temp); const char *ReciveAction = Recivejson->getItemStringFMValue("action"); if (strcmp(ReciveAction, "1001") == 0) { char const *userlist = Recivejson->getItemStringFMValue("userlist"); __android_log_print(ANDROID_LOG_INFO,"Test","userlist = %s", userlist); GameUserSelectedNotification(userlist);//userlist tReturn.c_str() } else if (strcmp(ReciveAction, "1002") == 0) { // char const *userlist = Recivejson->getItemStringFMValue("userlist"); // GameReplayNotification(userlist); } else if (strcmp(ReciveAction, "1003") == 0) { __android_log_print(ANDROID_LOG_INFO,"Test","LogoutNotify1003"); LogoutNotify(); } else if (strcmp(ReciveAction, "1004") == 0) { bool isOn = Recivejson->getItemBoolFMvalue("isOn",false); MusicTurnOffAndOn(isOn); } else if (strcmp(ReciveAction, "1005") == 0) { bool isOn = Recivejson->getItemBoolFMvalue("isOn",false); SoundTurnOffAndOn(isOn); } else if (strcmp(ReciveAction, "1006") == 0) { int aisLogin = Recivejson->getItemIntFMValue("isLogin",0); LoginResult(aisLogin); __android_log_print(ANDROID_LOG_INFO,"Test","LoginResult 1006 = %d", aisLogin); } else if (strcmp(ReciveAction, "1007") == 0) { __android_log_print(ANDROID_LOG_INFO,"Test","GameBackNotification 1007"); GameBackNotification(); } else if (strcmp(ReciveAction, "1008") == 0) { // ApplicationWillResignActive(); } else { __android_log_print(ANDROID_LOG_INFO,"SDKCallbackError","Have no this callback !"); return; } } #endif }
我們提供的服務(wù)有:網(wǎng)站制作、成都做網(wǎng)站、微信公眾號(hào)開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、嘉祥ssl等。為上1000+企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的嘉祥網(wǎng)站制作公司
珊瑚SDK官方調(diào)用例子,可以下載來看看哦,對(duì)于Android開發(fā)接入jni還是有很大的幫助