1.修改集成SDK代码
Showing
11 changed files
with
75 additions
and
20 deletions
| ... | @@ -1439,6 +1439,10 @@ cc.Class({ | ... | @@ -1439,6 +1439,10 @@ cc.Class({ |
| 1439 | 1439 | ||
| 1440 | doCurrentFocusTVLinkAction: function (strAction) { | 1440 | doCurrentFocusTVLinkAction: function (strAction) { |
| 1441 | let strTVLink = this._fiCurrentFocus.getTVLink(); | 1441 | let strTVLink = this._fiCurrentFocus.getTVLink(); |
| 1442 | //福建测试视频播放功能 | ||
| 1443 | if (strTVLink == "{\"click\":[{\"action\":\"ChangeScene\",\"parameters\":{\"sceneName\":\"sceneGameCategory\",\"currentIndex\":\"0\"}}]}") { | ||
| 1444 | strTVLink = "{\"click\":[{\"action\":\"ChangeScene\",\"parameters\":{\"sceneName\":\"sceneVideoDetail\"}}]}"; | ||
| 1445 | } | ||
| 1442 | cc.log("tvlink===============" + strTVLink); | 1446 | cc.log("tvlink===============" + strTVLink); |
| 1443 | // cc.log("tvlink===============" + this._oSceneContext._iPageIndex); | 1447 | // cc.log("tvlink===============" + this._oSceneContext._iPageIndex); |
| 1444 | try { | 1448 | try { | ... | ... |
| ... | @@ -64,16 +64,16 @@ | ... | @@ -64,16 +64,16 @@ |
| 64 | <!-- 未来NewTV --> | 64 | <!-- 未来NewTV --> |
| 65 | <meta-data | 65 | <meta-data |
| 66 | android:name="NewTV.APPID" | 66 | android:name="NewTV.APPID" |
| 67 | android:value="0e0777adb659479" /> | 67 | android:value="8e663b3ce392485" /> |
| 68 | <meta-data | 68 | <meta-data |
| 69 | android:name="NewTV.channelCode" | 69 | android:name="NewTV.channelCode" |
| 70 | android:value="\2626035001" /> | 70 | android:value="\2626035001" /> |
| 71 | <meta-data | 71 | <meta-data |
| 72 | android:name="NewTV.Appkey" | 72 | android:name="NewTV.Appkey" |
| 73 | android:value="df4fc19c4673bf9b5e70a7a56ece35e5" /> | 73 | android:value="4b9ee656631d5d78f112c7ad2b71ea5d" /> |
| 74 | <meta-data | 74 | <meta-data |
| 75 | android:name="NewTV.AppSecret" | 75 | android:name="NewTV.AppSecret" |
| 76 | android:value="ec695c7b7371db8dbd84a6d01e4c66a9" /> | 76 | android:value="35199e11ef90c60e51187498e5e4769" /> |
| 77 | 77 | ||
| 78 | <activity | 78 | <activity |
| 79 | android:name="org.cocos2dx.javascript.AppActivity" | 79 | android:name="org.cocos2dx.javascript.AppActivity" | ... | ... |
| ... | @@ -63,6 +63,13 @@ android { | ... | @@ -63,6 +63,13 @@ android { |
| 63 | keyPassword RELEASE_KEY_PASSWORD | 63 | keyPassword RELEASE_KEY_PASSWORD |
| 64 | } | 64 | } |
| 65 | } | 65 | } |
| 66 | |||
| 67 | config { | ||
| 68 | keyAlias 'topdraw' | ||
| 69 | keyPassword 'Topdraw!17qaz' | ||
| 70 | storeFile file('D:/Android/topdraw.keystore') | ||
| 71 | storePassword 'Topdraw!17qaz' | ||
| 72 | } | ||
| 66 | } | 73 | } |
| 67 | 74 | ||
| 68 | buildTypes { | 75 | buildTypes { |
| ... | @@ -74,7 +81,7 @@ android { | ... | @@ -74,7 +81,7 @@ android { |
| 74 | shrinkResources false | 81 | shrinkResources false |
| 75 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | 82 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
| 76 | if (project.hasProperty("RELEASE_STORE_FILE")) { | 83 | if (project.hasProperty("RELEASE_STORE_FILE")) { |
| 77 | signingConfig signingConfigs.release | 84 | signingConfig signingConfigs.config |
| 78 | } | 85 | } |
| 79 | 86 | ||
| 80 | externalNativeBuild { | 87 | externalNativeBuild { |
| ... | @@ -93,6 +100,7 @@ android { | ... | @@ -93,6 +100,7 @@ android { |
| 93 | arguments 'NDK_DEBUG=1' | 100 | arguments 'NDK_DEBUG=1' |
| 94 | } | 101 | } |
| 95 | } | 102 | } |
| 103 | signingConfig signingConfigs.config | ||
| 96 | } | 104 | } |
| 97 | } | 105 | } |
| 98 | } | 106 | } | ... | ... |
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/libs/armeabi-v7a/libadsdk.so
0 → 100644
No preview for this file type
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/libs/armeabi-v7a/libkystb.so
0 → 100644
No preview for this file type
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/libs/armeabi-v7a/liblogsdk.so
0 → 100644
No preview for this file type
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/libs/armeabi-v7a/libottlogin.so
0 → 100644
No preview for this file type
| ... | @@ -30,7 +30,9 @@ import org.cocos2dx.javascript.component.NewTVSDK; | ... | @@ -30,7 +30,9 @@ import org.cocos2dx.javascript.component.NewTVSDK; |
| 30 | import org.cocos2dx.lib.Cocos2dxActivity; | 30 | import org.cocos2dx.lib.Cocos2dxActivity; |
| 31 | import org.cocos2dx.lib.Cocos2dxGLSurfaceView; | 31 | import org.cocos2dx.lib.Cocos2dxGLSurfaceView; |
| 32 | 32 | ||
| 33 | import android.app.AlarmManager; | ||
| 33 | import android.app.AlertDialog; | 34 | import android.app.AlertDialog; |
| 35 | import android.app.PendingIntent; | ||
| 34 | import android.content.BroadcastReceiver; | 36 | import android.content.BroadcastReceiver; |
| 35 | import android.content.Context; | 37 | import android.content.Context; |
| 36 | import android.content.DialogInterface; | 38 | import android.content.DialogInterface; |
| ... | @@ -68,11 +70,7 @@ import java.net.URLEncoder; | ... | @@ -68,11 +70,7 @@ import java.net.URLEncoder; |
| 68 | import java.util.HashMap; | 70 | import java.util.HashMap; |
| 69 | import java.util.Map; | 71 | import java.util.Map; |
| 70 | 72 | ||
| 71 | import tv.icntv.adsdk.AdSDK; | ||
| 72 | import tv.icntv.logsdk.logSDK; | ||
| 73 | import tv.icntv.ottlogin.loginSDK; | ||
| 74 | import org.cocos2dx.javascript.component.CocosMediaPlayer; | 73 | import org.cocos2dx.javascript.component.CocosMediaPlayer; |
| 75 | import com.topdraw.forfun.R; | ||
| 76 | import org.cocos2dx.javascript.common.CommonUtils; | 74 | import org.cocos2dx.javascript.common.CommonUtils; |
| 77 | import org.cocos2dx.javascript.common.MelodyApplication; | 75 | import org.cocos2dx.javascript.common.MelodyApplication; |
| 78 | import org.cocos2dx.javascript.common.TopdrawSDKWrapper; | 76 | import org.cocos2dx.javascript.common.TopdrawSDKWrapper; |
| ... | @@ -88,6 +86,7 @@ public class AppActivity extends Cocos2dxActivity { | ... | @@ -88,6 +86,7 @@ public class AppActivity extends Cocos2dxActivity { |
| 88 | private RelativeLayout relativeLayout; | 86 | private RelativeLayout relativeLayout; |
| 89 | private RelativeLayout mRLSingleColor; | 87 | private RelativeLayout mRLSingleColor; |
| 90 | private RelativeLayout mOBiLayout; | 88 | private RelativeLayout mOBiLayout; |
| 89 | private static String target; | ||
| 91 | 90 | ||
| 92 | public static boolean baminSDKInited = false; | 91 | public static boolean baminSDKInited = false; |
| 93 | public static String APP_KEY; | 92 | public static String APP_KEY; |
| ... | @@ -99,6 +98,7 @@ public class AppActivity extends Cocos2dxActivity { | ... | @@ -99,6 +98,7 @@ public class AppActivity extends Cocos2dxActivity { |
| 99 | private static String TOPDRAW_PLATFORM_SERVER; | 98 | private static String TOPDRAW_PLATFORM_SERVER; |
| 100 | private static String TOPDRAW_APPID; | 99 | private static String TOPDRAW_APPID; |
| 101 | private static String TOPDRAW_APPSECRET; | 100 | private static String TOPDRAW_APPSECRET; |
| 101 | private static String TOPDRAW_REFER_PATH; | ||
| 102 | 102 | ||
| 103 | public static String TOPDRAW_API_PATH = "http://demo.cloud.api.findfun.topdraw.cn:38081/findfun"; | 103 | public static String TOPDRAW_API_PATH = "http://demo.cloud.api.findfun.topdraw.cn:38081/findfun"; |
| 104 | 104 | ||
| ... | @@ -155,7 +155,7 @@ public class AppActivity extends Cocos2dxActivity { | ... | @@ -155,7 +155,7 @@ public class AppActivity extends Cocos2dxActivity { |
| 155 | return; | 155 | return; |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | CocosMediaPlayer.getInstence(this, CocosMediaPlayer.TYPE.Android); //add jerry | 158 | CocosMediaPlayer.getInstence(this, CocosMediaPlayer.TYPE.NewTV); //add jerry |
| 159 | 159 | ||
| 160 | mUIHandler = new Handler(); | 160 | mUIHandler = new Handler(); |
| 161 | // 显示launch image 遮住「黑屏」 | 161 | // 显示launch image 遮住「黑屏」 |
| ... | @@ -181,8 +181,10 @@ public class AppActivity extends Cocos2dxActivity { | ... | @@ -181,8 +181,10 @@ public class AppActivity extends Cocos2dxActivity { |
| 181 | TOPDRAW_PLATFORM_SERVER = appInfo.metaData.getString("TOPDRAW.PLATFORM_SERVER"); | 181 | TOPDRAW_PLATFORM_SERVER = appInfo.metaData.getString("TOPDRAW.PLATFORM_SERVER"); |
| 182 | TOPDRAW_APPID = appInfo.metaData.getString("TOPDRAW.APPID"); | 182 | TOPDRAW_APPID = appInfo.metaData.getString("TOPDRAW.APPID"); |
| 183 | TOPDRAW_APPSECRET = appInfo.metaData.getString("TOPDRAW.APPSECRET"); | 183 | TOPDRAW_APPSECRET = appInfo.metaData.getString("TOPDRAW.APPSECRET"); |
| 184 | TOPDRAW_REFER_PATH = TOPDRAW_PLATFORM_SERVER + "/Platform/Logout"; | ||
| 184 | TopdrawSDK.init(getApplicationContext(), TOPDRAW_PLATFORM, TOPDRAW_PLATFORM_SERVER, TOPDRAW_APPID, TOPDRAW_APPSECRET, initListener); | 185 | TopdrawSDK.init(getApplicationContext(), TOPDRAW_PLATFORM, TOPDRAW_PLATFORM_SERVER, TOPDRAW_APPID, TOPDRAW_APPSECRET, initListener); |
| 185 | 186 | ||
| 187 | //移动埋点 | ||
| 186 | APP_KEY = appInfo.metaData.getString("CMCC.APPKEY"); | 188 | APP_KEY = appInfo.metaData.getString("CMCC.APPKEY"); |
| 187 | APP_NAME = getString(R.string.app_name); | 189 | APP_NAME = getString(R.string.app_name); |
| 188 | 190 | ||
| ... | @@ -237,6 +239,20 @@ public class AppActivity extends Cocos2dxActivity { | ... | @@ -237,6 +239,20 @@ public class AppActivity extends Cocos2dxActivity { |
| 237 | super.onDestroy(); | 239 | super.onDestroy(); |
| 238 | unregisterReceiver(receiver); | 240 | unregisterReceiver(receiver); |
| 239 | SDKWrapper.getInstance().onDestroy(); | 241 | SDKWrapper.getInstance().onDestroy(); |
| 242 | TopdrawSDK.destory(this, null, new ITopdrawResultListener() { | ||
| 243 | @Override | ||
| 244 | public void onResult(int i, String s, Object o) { | ||
| 245 | Log.d(TAG, "destory " + i + " " + s); | ||
| 246 | try { | ||
| 247 | if (baminSDKInited) { | ||
| 248 | SDKUtil.getInstance().ky_quit(); | ||
| 249 | } | ||
| 250 | System.exit(0); | ||
| 251 | } catch (Throwable t) { | ||
| 252 | |||
| 253 | } | ||
| 254 | } | ||
| 255 | }); | ||
| 240 | } | 256 | } |
| 241 | 257 | ||
| 242 | @Override | 258 | @Override |
| ... | @@ -375,10 +391,23 @@ public class AppActivity extends Cocos2dxActivity { | ... | @@ -375,10 +391,23 @@ public class AppActivity extends Cocos2dxActivity { |
| 375 | private ITopdrawResultListener initListener = new ITopdrawResultListener() { | 391 | private ITopdrawResultListener initListener = new ITopdrawResultListener() { |
| 376 | @Override | 392 | @Override |
| 377 | public void onResult(int result, String msg, Object obj) { | 393 | public void onResult(int result, String msg, Object obj) { |
| 378 | // LOG(TAG, "onResult " + result + " " + msg + " " + obj); | 394 | Log.d(TAG, "onResult " + result + " " + msg + " " + obj);//-1020 init topdraw sdk error null |
| 379 | if (0 == result) { | 395 | if (0 == result) { |
| 380 | MelodyApplication.sdk = (ITopdrawSDK) obj; | 396 | MelodyApplication.sdk = (ITopdrawSDK) obj; |
| 381 | USER_ID = MelodyApplication.sdk.getOssUserID(); | 397 | USER_ID = MelodyApplication.sdk.getOssUserID(); |
| 398 | |||
| 399 | CookieManager.getInstance().setCookie(TOPDRAW_PLATFORM_SERVER, "appId=" + TOPDRAW_APPID); | ||
| 400 | CookieManager.getInstance().setCookie(TOPDRAW_PLATFORM_SERVER, "userId=" + MelodyApplication.sdk.getUserID()); | ||
| 401 | CookieManager.getInstance().setCookie(TOPDRAW_PLATFORM_SERVER, "platformUserId=" + MelodyApplication.sdk.getOssUserID()); | ||
| 402 | try { | ||
| 403 | CookieManager.getInstance().setCookie(TOPDRAW_PLATFORM_SERVER, "referURL=" + URLEncoder.encode(TOPDRAW_REFER_PATH, "UTF-8")); | ||
| 404 | } catch (Exception e) { | ||
| 405 | |||
| 406 | } | ||
| 407 | if (null != target && !"".equals(target)) { | ||
| 408 | CookieManager.getInstance().setCookie(TOPDRAW_PLATFORM_SERVER, "target=" + target); | ||
| 409 | } | ||
| 410 | |||
| 382 | MelodyApplication.isSDKInited = true; | 411 | MelodyApplication.isSDKInited = true; |
| 383 | 412 | ||
| 384 | //局方埋点 | 413 | //局方埋点 |
| ... | @@ -414,11 +443,11 @@ public class AppActivity extends Cocos2dxActivity { | ... | @@ -414,11 +443,11 @@ public class AppActivity extends Cocos2dxActivity { |
| 414 | 443 | ||
| 415 | } | 444 | } |
| 416 | } else if (-1020 == result) { | 445 | } else if (-1020 == result) { |
| 417 | Toast.makeText(AppActivity.this, "网络异常,请重试", Toast.LENGTH_LONG).show(); | 446 | // Toast.makeText(AppActivity.this, "网络异常,请重试", Toast.LENGTH_LONG).show(); |
| 418 | finish(); | 447 | // finish(); |
| 419 | } else { | 448 | } else { |
| 420 | Toast.makeText(AppActivity.this, "启动异常,请重试", Toast.LENGTH_LONG).show(); | 449 | // Toast.makeText(AppActivity.this, "启动异常,请重试", Toast.LENGTH_LONG).show(); |
| 421 | finish(); | 450 | // finish(); |
| 422 | } | 451 | } |
| 423 | } | 452 | } |
| 424 | }; | 453 | }; | ... | ... |
| ... | @@ -11,6 +11,7 @@ import org.cocos2dx.javascript.component.player.AndroidMediaPlayer; | ... | @@ -11,6 +11,7 @@ import org.cocos2dx.javascript.component.player.AndroidMediaPlayer; |
| 11 | //import com.topdraw.component.player.NewTVMediaPlayer; | 11 | //import com.topdraw.component.player.NewTVMediaPlayer; |
| 12 | //import com.topdraw.component.player.VitamioMediaPlayer; | 12 | //import com.topdraw.component.player.VitamioMediaPlayer; |
| 13 | 13 | ||
| 14 | import org.cocos2dx.javascript.component.player.NewTVMediaPlayer; | ||
| 14 | import org.cocos2dx.lib.Cocos2dxActivity; | 15 | import org.cocos2dx.lib.Cocos2dxActivity; |
| 15 | import org.cocos2dx.lib.Cocos2dxJavascriptJavaBridge; | 16 | import org.cocos2dx.lib.Cocos2dxJavascriptJavaBridge; |
| 16 | 17 | ||
| ... | @@ -102,7 +103,7 @@ public class CocosMediaPlayer { | ... | @@ -102,7 +103,7 @@ public class CocosMediaPlayer { |
| 102 | if (TYPE.Android.name().equals(type)) { | 103 | if (TYPE.Android.name().equals(type)) { |
| 103 | mp = new AndroidMediaPlayer(); | 104 | mp = new AndroidMediaPlayer(); |
| 104 | } else if (TYPE.NewTV.name().equals(type)) { | 105 | } else if (TYPE.NewTV.name().equals(type)) { |
| 105 | // mp = new NewTVMediaPlayer(); | 106 | mp = new NewTVMediaPlayer(); |
| 106 | } else if (TYPE.Vitamio.name().equals(type)) { | 107 | } else if (TYPE.Vitamio.name().equals(type)) { |
| 107 | // mp = new VitamioMediaPlayer(); | 108 | // mp = new VitamioMediaPlayer(); |
| 108 | } else if (TYPE.IJK.name().equals(type)) { | 109 | } else if (TYPE.IJK.name().equals(type)) { | ... | ... |
| ... | @@ -5,6 +5,7 @@ import android.content.pm.ApplicationInfo; | ... | @@ -5,6 +5,7 @@ import android.content.pm.ApplicationInfo; |
| 5 | import android.content.pm.PackageInfo; | 5 | import android.content.pm.PackageInfo; |
| 6 | import android.content.pm.PackageManager; | 6 | import android.content.pm.PackageManager; |
| 7 | import android.os.Handler; | 7 | import android.os.Handler; |
| 8 | import android.util.Log; | ||
| 8 | import android.view.WindowManager; | 9 | import android.view.WindowManager; |
| 9 | import android.widget.FrameLayout; | 10 | import android.widget.FrameLayout; |
| 10 | import android.widget.Toast; | 11 | import android.widget.Toast; |
| ... | @@ -19,6 +20,7 @@ import tv.icntv.ottlogin.loginSDK; | ... | @@ -19,6 +20,7 @@ import tv.icntv.ottlogin.loginSDK; |
| 19 | 20 | ||
| 20 | public class NewTVSDK { | 21 | public class NewTVSDK { |
| 21 | 22 | ||
| 23 | private static final String TAG = "NewTVSDK"; | ||
| 22 | private static NewTVSDK instence; | 24 | private static NewTVSDK instence; |
| 23 | private Context context; | 25 | private Context context; |
| 24 | private PackageInfo packageInfo; | 26 | private PackageInfo packageInfo; |
| ... | @@ -51,12 +53,22 @@ public class NewTVSDK { | ... | @@ -51,12 +53,22 @@ public class NewTVSDK { |
| 51 | } | 53 | } |
| 52 | 54 | ||
| 53 | loginSDK sdk = loginSDK.getInstance(); | 55 | loginSDK sdk = loginSDK.getInstance(); |
| 54 | String newTVAPPID = appInfo.metaData.getString("NewTV.APPID");; | 56 | //这里的账号返回1003,签名错误 |
| 55 | String newTVChannelCode = appInfo.metaData.getString("NewTV.channelCode"); | 57 | // String newTVAPPID = appInfo.metaData.getString("NewTV.APPID"); |
| 56 | String newTVAppkey = appInfo.metaData.getString("NewTV.Appkey"); | 58 | // String newTVChannelCode = appInfo.metaData.getString("NewTV.channelCode"); |
| 57 | String newTVAppSecret =appInfo.metaData.getString("NewTV.AppSecret"); | 59 | // String newTVAppkey = appInfo.metaData.getString("NewTV.Appkey"); |
| 58 | sdk.sdkInit(loginSDK.TYPE_COMMON, newTVChannelCode, newTVAppkey, newTVAppSecret, context); | 60 | // String newTVAppSecret = appInfo.metaData.getString("NewTV.AppSecret"); |
| 61 | // String newTVAPPID = "4bf34d0e9acf4aa"; | ||
| 62 | // String newTVChannelCode = "2626046001"; | ||
| 63 | // String newTVAppkey = "2e535b79fc515eb17c3c2039517d6c27"; | ||
| 64 | // String newTVAppSecret = "4160dcc2d67eecea0410dc770856d3ae"; | ||
| 65 | String newTVAPPID = "0e0777adb659479"; //东成私塾 | ||
| 66 | String newTVChannelCode = "2626035001"; | ||
| 67 | String newTVAppkey = "df4fc19c4673bf9b5e70a7a56ece35e5"; | ||
| 68 | String newTVAppSecret = "ec695c7b7371db8dbd84a6d01e4c66a9"; | ||
| 69 | boolean flag=sdk.sdkInit(loginSDK.TYPE_COMMON, newTVChannelCode, newTVAppkey, newTVAppSecret, context);//初始化是成功的 | ||
| 59 | String retDeviceLogin = sdk.deviceLogin(); | 70 | String retDeviceLogin = sdk.deviceLogin(); |
| 71 | Log.d("NewTVSDK", flag+" init->deviceLogin..." + sdk.toString()); | ||
| 60 | logSDK logsdk; | 72 | logSDK logsdk; |
| 61 | AdSDK adsdk = null; | 73 | AdSDK adsdk = null; |
| 62 | ADFrameLayout adfl = null; | 74 | ADFrameLayout adfl = null; |
| ... | @@ -64,6 +76,7 @@ public class NewTVSDK { | ... | @@ -64,6 +76,7 @@ public class NewTVSDK { |
| 64 | if ("1".equals(retDeviceLogin) || "766".equals(retDeviceLogin) || "777".equals(retDeviceLogin) || "891".equals(retDeviceLogin)) { | 76 | if ("1".equals(retDeviceLogin) || "766".equals(retDeviceLogin) || "777".equals(retDeviceLogin) || "891".equals(retDeviceLogin)) { |
| 65 | StringBuffer sbDeviceID = new StringBuffer(); | 77 | StringBuffer sbDeviceID = new StringBuffer(); |
| 66 | int retDeviceID = sdk.getDeviceID(sbDeviceID); | 78 | int retDeviceID = sdk.getDeviceID(sbDeviceID); |
| 79 | Log.d(TAG,"init->deviceID"+sbDeviceID.toString()); | ||
| 67 | if (0 == retDeviceID) { | 80 | if (0 == retDeviceID) { |
| 68 | StringBuffer sbLogServer = new StringBuffer(); | 81 | StringBuffer sbLogServer = new StringBuffer(); |
| 69 | int getLogServer = sdk.getServerAddress("USER_LOG", sbLogServer); | 82 | int getLogServer = sdk.getServerAddress("USER_LOG", sbLogServer); | ... | ... |
-
Please register or sign in to post a comment