Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
apk_product
/
ForFun
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
4b684c1e
...
4b684c1ed475a7faf5e386a6625cba656a2159b8
authored
2020-07-21 10:53:25 +0800
by
胡国瑞
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
华为盒子无法获取EPG SERVER和TOKEN问题
1 parent
a730aac7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
12 deletions
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/src/org/cocos2dx/javascript/common/CommonUtils.java
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/src/org/cocos2dx/javascript/common/CommonUtils.java
View file @
4b684c1
package
org
.
cocos2dx
.
javascript
.
common
;
import
android.app.AlertDialog
;
import
android.content.ContentResolver
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
...
...
@@ -92,13 +93,20 @@ public class CommonUtils {
public
static
String
getToken
(
Context
context
)
{
String
value
=
""
;
Uri
uri
=
Uri
.
parse
(
"content://stbconfig/authentication
/user_token
"
);
String
userToken
=
""
;
Uri
uri
=
Uri
.
parse
(
"content://stbconfig/authentication"
);
Cursor
c
=
null
;
try
{
c
=
context
.
getContentResolver
().
query
(
uri
,
null
,
"name = ?"
,
new
String
[]{
"user_token"
},
null
);
// 建议使用这种name=?参数化的查询语句来操作
if
(
c
!=
null
&&
c
.
moveToFirst
())
{
value
=
c
.
getString
(
c
.
getColumnIndex
(
"value"
));
ContentResolver
cr
=
context
.
getContentResolver
();
c
=
cr
.
query
(
uri
,
null
,
null
,
null
,
null
);
while
(
null
!=
c
&&
c
.
moveToNext
())
{
String
name
=
c
.
getString
(
c
.
getColumnIndex
(
"name"
));
String
value
=
c
.
getString
(
c
.
getColumnIndex
(
"value"
));
Log
.
d
(
TAG
,
name
+
": "
+
value
);
if
(
TextUtils
.
equals
(
name
,
"user_token"
))
{
userToken
=
value
;
break
;
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -108,17 +116,26 @@ public class CommonUtils {
}
}
// Log.d(TAG, "获取机顶盒token..." + value);
return
value
;
Log
.
d
(
TAG
,
"got user token: "
+
userToken
);
return
userToken
;
}
public
static
String
getServer
(
Context
context
)
{
String
value
=
""
;
Uri
uri
=
Uri
.
parse
(
"content://stbconfig/authentication/epg_server"
);
String
epgServer
=
""
;
// Uri uri = Uri.parse("content://stbconfig/authentication/epg_server");
Uri
uri
=
Uri
.
parse
(
"content://stbconfig/authentication"
);
Cursor
c
=
null
;
try
{
c
=
context
.
getContentResolver
().
query
(
uri
,
null
,
"name = ?"
,
new
String
[]{
"epg_server"
},
null
);
// 建议使用这种name=?参数化的查询语句来操作
if
(
c
!=
null
&&
c
.
moveToFirst
())
{
value
=
c
.
getString
(
c
.
getColumnIndex
(
"value"
));
ContentResolver
cr
=
context
.
getContentResolver
();
c
=
cr
.
query
(
uri
,
null
,
null
,
null
,
null
);
while
(
null
!=
c
&&
c
.
moveToNext
())
{
String
name
=
c
.
getString
(
c
.
getColumnIndex
(
"name"
));
String
value
=
c
.
getString
(
c
.
getColumnIndex
(
"value"
));
Log
.
d
(
TAG
,
name
+
": "
+
value
);
if
(
TextUtils
.
equals
(
name
,
"epg_server"
))
{
epgServer
=
value
;
break
;
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -128,7 +145,8 @@ public class CommonUtils {
}
}
// Log.d(TAG, "获取机顶盒token..." + value);
return
value
;
Log
.
d
(
TAG
,
"got epg server: "
+
epgServer
);
return
epgServer
;
}
//检查网络
...
...
Please
register
or
sign in
to post a comment