参考珊瑚SDK,jni的调用方式

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
}

我们提供的服务有:网站制作、成都做网站、微信公众号开发、网站优化、网站认证、嘉祥ssl等。为上1000+企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的嘉祥网站制作公司

珊瑚SDK官方调用例子,可以下载来看看哦,对于Android开发接入jni还是有很大的帮助


本文名称:参考珊瑚SDK,jni的调用方式
文章转载:http://bzwzjz.com/article/isgidj.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 成都网站建设公司 营销网站建设 成都网站建设 成都品牌网站建设 成都网站建设公司 成都网站设计公司 网站制作报价 专业网站建设 成都网站制作 移动网站建设 H5网站制作 app网站建设 定制级高端网站建设 重庆手机网站建设 成都网站制作 成都网站建设 成都网站建设 成都网站设计 企业手机网站建设 成都网站建设 成都网站设计 定制网站设计