Permalink
Browse files

修改初始化参数的问题

  • Loading branch information...
yhxjw86 committed Jun 15, 2017
1 parent 553a22c commit 55d5a4e81495d6aea4160bb6ff994712cff71db8
View
@@ -208,5 +208,5 @@ void AppDelegate::initShareSDKConfig()
totalDict -> setObject(youTubeConf, youTube.str());
*/
cn::sharesdk::C2DXShareSDK::registerAppAndSetPlatformConfig("8e3320a36606", totalDict);
cn::sharesdk::C2DXShareSDK::registerAppAndSetPlatformConfig("moba6b6c6d6","b89d2427a3bc7ad1aea1e1e8c1d36bf3",totalDict);
}
@@ -94,23 +94,24 @@ void releaseMethod(JniMethodInfo &mi) {
mi.env->DeleteLocalRef(mi.classID);
}
bool registerAppAndSetPlatformConfigJNI(const char* appKey, C2DXDictionary *platformInfos) {
bool registerAppAndSetPlatformConfigJNI(const char* appKey,const char* appSecret, C2DXDictionary *platformInfos) {
JniMethodInfo mi;
bool isHave = getMethod(mi, "initSDKAndSetPlatfromConfig", "(Ljava/lang/String;Ljava/lang/String;)V");
if (!isHave) {
return false;
}
jstring jInfo = NULL;
jstring jAppKey = NULL;
jstring jAppSecret = NULL;
if (platformInfos != NULL) {
CCJSONConverter* json = CCJSONConverter::sharedConverter();
const char* ccInfo = json->strFrom(platformInfos);
jInfo = mi.env->NewStringUTF(ccInfo);
}
jAppKey = mi.env->NewStringUTF(appKey);
mi.env->CallStaticVoidMethod(mi.classID, mi.methodID, jAppKey, jInfo);
jAppSecret = mi.env->NewStringUTF(appSecret);
mi.env->CallStaticVoidMethod(mi.classID, mi.methodID, jAppKey,jAppSecret,jInfo);
releaseMethod(mi);
return true;
}
@@ -43,11 +43,12 @@ bool getMethod(JniMethodInfo &mi, const char *methodName, const char *paramCode)
void releaseMethod(JniMethodInfo &mi);
//jni methods
bool initSDKJNI(const char* appKey);
bool initSDKJNI(const char* appKey,const char* appSecret);
bool setPlatformConfigJNI(int platformId, C2DXDictionary *platConfig);
bool registerAppAndSetPlatformConfigJNI(const char* appKey, C2DXDictionary *platformInfos);
bool registerAppAndSetPlatformConfigJNI(const char* appKey,const char* appSecret, C2DXDictionary *platformInfos);
bool authorizeJNI(int reqID, int platformId, C2DXAuthResultEvent callback);
@@ -69,13 +69,13 @@ const char* PlatId::Any = "999"; /**< 任意平台 */
int reqID = 0;
void C2DXShareSDK::registerAppAndSetPlatformConfig(const char *appKey, C2DXDictionary *configInfo)
void C2DXShareSDK::registerAppAndSetPlatformConfig(const char *appKey,const char *appSecret, C2DXDictionary *configInfo)
{
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
//Andorid
// This is not a necessary method for Android, you can setup your platform configs more efficiently in "assets/ShareSDK.xml"
registerAppAndSetPlatformConfigJNI(appKey, configInfo);
registerAppAndSetPlatformConfigJNI(appKey,appSecret, configInfo);
#elif CC_TARGET_PLATFORM == CC_PLATFORM_IOS
@@ -82,8 +82,8 @@ namespace cn
* @param platType 平台类型
* @param configInfo 配置信息
*/
static void registerAppAndSetPlatformConfig(const char *appKey, C2DXDictionary *configInfo);
static void registerAppAndSetPlatformConfig(const char *appKey,const char *appSecret, C2DXDictionary *configInfo);
/**
* @brief 用户授权
*
View
@@ -53,7 +53,8 @@
-->
<ShareSDK
AppKey = "androidv1101"/> <!-- 修改成你在sharesdk后台注册的应用的appkey"-->
AppKey = "moba6b6c6d6"
AppSecret ="b89d2427a3bc7ad1aea1e1e8c1d36bf3"/> <!-- 修改成你在sharesdk后台注册的应用的appkey"-->
<!-- ShareByAppClient标识是否使用微博客户端分享,默认是false -->
<SinaWeibo
@@ -51,15 +51,16 @@ public void run() {
private static native void onJavaCallback(String resp);
public static void initSDKAndSetPlatfromConfig(final String appKey,final String configs) {
public static void initSDKAndSetPlatfromConfig(final String appKey,final String appSecret,final String configs) {
if (DEBUG) {
System.out.println("initSDKAndSetPlatfromConfig");
}
UIHandler.sendEmptyMessage(1, new Callback() {
public boolean handleMessage(Message msg) {
if (!TextUtils.isEmpty(appKey)) {
if (!TextUtils.isEmpty(appKey) && !TextUtils.isEmpty(appSecret)) {
MobSDK.init(context,appKey,appSecret);
} else if(!TextUtils.isEmpty(appKey)){
MobSDK.init(context,appKey);
} else {
MobSDK.init(context);

0 comments on commit 55d5a4e

Please sign in to comment.