1.修正未来SDK的参数AppSecret,解决未来SDK认证模块失败的问题
Showing
4 changed files
with
35 additions
and
9 deletions
... | @@ -73,7 +73,7 @@ | ... | @@ -73,7 +73,7 @@ |
73 | android:value="4b9ee656631d5d78f112c7ad2b71ea5d" /> | 73 | android:value="4b9ee656631d5d78f112c7ad2b71ea5d" /> |
74 | <meta-data | 74 | <meta-data |
75 | android:name="NewTV.AppSecret" | 75 | android:name="NewTV.AppSecret" |
76 | android:value="35199e11ef90c60e51187498e5e4769" /> | 76 | android:value="a35199e11ef90c60e51187498e5e4769" /> |
77 | 77 | ||
78 | <activity | 78 | <activity |
79 | android:name="org.cocos2dx.javascript.AppActivity" | 79 | android:name="org.cocos2dx.javascript.AppActivity" | ... | ... |
... | @@ -40,6 +40,8 @@ import android.content.IntentFilter; | ... | @@ -40,6 +40,8 @@ import android.content.IntentFilter; |
40 | import android.content.pm.ApplicationInfo; | 40 | import android.content.pm.ApplicationInfo; |
41 | import android.content.pm.PackageInfo; | 41 | import android.content.pm.PackageInfo; |
42 | import android.content.pm.PackageManager; | 42 | import android.content.pm.PackageManager; |
43 | import android.database.Cursor; | ||
44 | import android.net.Uri; | ||
43 | import android.os.Bundle; | 45 | import android.os.Bundle; |
44 | 46 | ||
45 | import android.content.Intent; | 47 | import android.content.Intent; |
... | @@ -59,6 +61,7 @@ import android.widget.ImageView; | ... | @@ -59,6 +61,7 @@ import android.widget.ImageView; |
59 | import android.widget.RelativeLayout; | 61 | import android.widget.RelativeLayout; |
60 | import android.widget.TextView; | 62 | import android.widget.TextView; |
61 | import android.widget.Toast; | 63 | import android.widget.Toast; |
64 | |||
62 | import com.knowyou_jni.single.SDKUtil; | 65 | import com.knowyou_jni.single.SDKUtil; |
63 | import com.topdraw.forfun.R; | 66 | import com.topdraw.forfun.R; |
64 | 67 | ||
... | @@ -111,6 +114,9 @@ public class AppActivity extends Cocos2dxActivity { | ... | @@ -111,6 +114,9 @@ public class AppActivity extends Cocos2dxActivity { |
111 | 114 | ||
112 | initSdkData(); | 115 | initSdkData(); |
113 | 116 | ||
117 | String token = getToken(); | ||
118 | Log.d(TAG, "获取机顶盒的Token..." + token); | ||
119 | |||
114 | //----解决游戏页按返回退出时,背景图透明度过高,onPause和onResume中控制显示还是隐藏 | 120 | //----解决游戏页按返回退出时,背景图透明度过高,onPause和onResume中控制显示还是隐藏 |
115 | singleView = LayoutInflater.from(this).inflate(R.layout.activity_main_single_color, null); | 121 | singleView = LayoutInflater.from(this).inflate(R.layout.activity_main_single_color, null); |
116 | mRLSingleColor = singleView.findViewById(R.id.ll_single); | 122 | mRLSingleColor = singleView.findViewById(R.id.ll_single); |
... | @@ -168,6 +174,25 @@ public class AppActivity extends Cocos2dxActivity { | ... | @@ -168,6 +174,25 @@ public class AppActivity extends Cocos2dxActivity { |
168 | SDKWrapper.getInstance().init(this); | 174 | SDKWrapper.getInstance().init(this); |
169 | } | 175 | } |
170 | 176 | ||
177 | private String getToken() { | ||
178 | String value = ""; | ||
179 | Uri uri = Uri.parse("content://stbconfig/authentication/user_token"); | ||
180 | Cursor c = null; | ||
181 | try { | ||
182 | c = getContentResolver().query(uri, null, "name = ?", new String[]{"stb_device_name "}, null); // 建议使用这种name=?参数化的查询语句来操作 | ||
183 | if (c != null && c.moveToFirst()) { | ||
184 | value = c.getString(c.getColumnIndex("value")); | ||
185 | } | ||
186 | } catch (Exception e) { | ||
187 | e.printStackTrace(); | ||
188 | } finally { | ||
189 | if (c != null) { | ||
190 | c.close(); // 游标放到finally块来释放。 | ||
191 | } | ||
192 | } | ||
193 | return value; | ||
194 | } | ||
195 | |||
171 | private void initSdkData() { | 196 | private void initSdkData() { |
172 | //init topdraw.jar----- | 197 | //init topdraw.jar----- |
173 | ApplicationInfo appInfo = null; | 198 | ApplicationInfo appInfo = null; |
... | @@ -415,6 +440,7 @@ public class AppActivity extends Cocos2dxActivity { | ... | @@ -415,6 +440,7 @@ public class AppActivity extends Cocos2dxActivity { |
415 | SDKUtil.isOpenLog = true; | 440 | SDKUtil.isOpenLog = true; |
416 | int sdkResult = SDKUtil.getInstance().ky_initWithAppKey(AppActivity.this, APP_KEY, | 441 | int sdkResult = SDKUtil.getInstance().ky_initWithAppKey(AppActivity.this, APP_KEY, |
417 | getPackageManager().getPackageInfo(getPackageName(), 0).versionName); | 442 | getPackageManager().getPackageInfo(getPackageName(), 0).versionName); |
443 | Log.d(TAG,"sdkResult..."+sdkResult); | ||
418 | baminSDKInited = (sdkResult == 0); | 444 | baminSDKInited = (sdkResult == 0); |
419 | Map<String, Object> params = new HashMap<>(); | 445 | Map<String, Object> params = new HashMap<>(); |
420 | params.put("appId", TOPDRAW_APPID); | 446 | params.put("appId", TOPDRAW_APPID); | ... | ... |
... | @@ -54,18 +54,18 @@ public class NewTVSDK { | ... | @@ -54,18 +54,18 @@ public class NewTVSDK { |
54 | 54 | ||
55 | loginSDK sdk = loginSDK.getInstance(); | 55 | loginSDK sdk = loginSDK.getInstance(); |
56 | //这里的账号返回1003,签名错误 | 56 | //这里的账号返回1003,签名错误 |
57 | // String newTVAPPID = appInfo.metaData.getString("NewTV.APPID"); | 57 | String newTVAPPID = appInfo.metaData.getString("NewTV.APPID"); |
58 | // String newTVChannelCode = appInfo.metaData.getString("NewTV.channelCode"); | 58 | String newTVChannelCode = appInfo.metaData.getString("NewTV.channelCode"); |
59 | // String newTVAppkey = appInfo.metaData.getString("NewTV.Appkey"); | 59 | String newTVAppkey = appInfo.metaData.getString("NewTV.Appkey"); |
60 | // String newTVAppSecret = appInfo.metaData.getString("NewTV.AppSecret"); | 60 | String newTVAppSecret = appInfo.metaData.getString("NewTV.AppSecret"); |
61 | // String newTVAPPID = "4bf34d0e9acf4aa"; | 61 | // String newTVAPPID = "4bf34d0e9acf4aa"; |
62 | // String newTVChannelCode = "2626046001"; | 62 | // String newTVChannelCode = "2626046001"; |
63 | // String newTVAppkey = "2e535b79fc515eb17c3c2039517d6c27"; | 63 | // String newTVAppkey = "2e535b79fc515eb17c3c2039517d6c27"; |
64 | // String newTVAppSecret = "4160dcc2d67eecea0410dc770856d3ae"; | 64 | // String newTVAppSecret = "4160dcc2d67eecea0410dc770856d3ae"; |
65 | String newTVAPPID = "0e0777adb659479"; //东成私塾 | 65 | // String newTVAPPID = "0e0777adb659479"; //东成私塾 |
66 | String newTVChannelCode = "2626035001"; | 66 | // String newTVChannelCode = "2626035001"; |
67 | String newTVAppkey = "df4fc19c4673bf9b5e70a7a56ece35e5"; | 67 | // String newTVAppkey = "df4fc19c4673bf9b5e70a7a56ece35e5"; |
68 | String newTVAppSecret = "ec695c7b7371db8dbd84a6d01e4c66a9"; | 68 | // String newTVAppSecret = "ec695c7b7371db8dbd84a6d01e4c66a9"; |
69 | boolean flag=sdk.sdkInit(loginSDK.TYPE_COMMON, newTVChannelCode, newTVAppkey, newTVAppSecret, context);//初始化是成功的 | 69 | boolean flag=sdk.sdkInit(loginSDK.TYPE_COMMON, newTVChannelCode, newTVAppkey, newTVAppSecret, context);//初始化是成功的 |
70 | String retDeviceLogin = sdk.deviceLogin(); | 70 | String retDeviceLogin = sdk.deviceLogin(); |
71 | Log.d("NewTVSDK", flag+" init->deviceLogin..." + sdk.toString()); | 71 | Log.d("NewTVSDK", flag+" init->deviceLogin..." + sdk.toString()); | ... | ... |
-
Please register or sign in to post a comment