Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
杨建斌
/
dy-wx2
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
5e6fc261
authored
2019-01-31 09:31:09 +0800
by
ex
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
查看Android的GPS
1 parent
27eb65ad
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
14 deletions
js/JSBridge.js
js/JSBridge.js
View file @
5e6fc26
...
...
@@ -75,7 +75,10 @@ AppClient.prototype.getGPS = function (jsonStr, callback) {
};
var
isRes
=
false
if
(
this
.
isAndroid
)
{
window
.
WebViewJavascriptBridge
.
callHandler
(
'getGPS'
,
jsonStr
,
function
(
data
,
responseCallback
)
{
var
cb
=
function
(
data
,
responseCallback
){
layer
.
open
({
content
:
JSON
.
stringify
(
data
)
})
isRes
=
true
var
latitude
=
''
var
longitude
=
''
...
...
@@ -85,21 +88,15 @@ AppClient.prototype.getGPS = function (jsonStr, callback) {
latitude
=
arr
[
0
].
split
(
'='
)[
1
]
longitude
=
arr
[
1
].
split
(
'='
)[
1
]
callback
(
latitude
,
longitude
,
responseCallback
)
}
window
.
WebViewJavascriptBridge
.
callHandler
(
'getGPS'
,
jsonStr
,
function
(
data
,
responseCallback
)
{
cb
(
data
,
responseCallback
)
})
window
.
WebViewJavascriptBridge
.
callHandler
(
'postGPS'
,
function
(
data
,
responseCallback
)
{
isRes
=
true
var
latitude
=
''
var
longitude
=
''
var
str
=
JSON
.
stringify
(
data
)
var
result
=
/
\{([\s\S]
*
)\}
/
.
exec
(
str
);
var
arr
=
result
[
1
].
split
(
','
)
latitude
=
arr
[
0
].
split
(
'='
)[
1
]
longitude
=
arr
[
1
].
split
(
'='
)[
1
]
callback
(
latitude
,
longitude
,
responseCallback
)
cb
(
data
,
responseCallback
)
})
}
else
{
this
.
appObj
.
registerHandler
(
"postGPS"
,
function
(
data
,
responseCallback
)
{
isRes
=
true
var
latitude
=
''
var
longitude
=
''
...
...
@@ -108,9 +105,6 @@ AppClient.prototype.getGPS = function (jsonStr, callback) {
var
arr
=
result
[
1
].
split
(
','
)
longitude
=
arr
[
0
].
split
(
':'
)[
1
]
latitude
=
arr
[
1
].
split
(
':'
)[
1
]
callback
(
latitude
,
longitude
,
responseCallback
)
})
this
.
appObj
.
callHandler
(
"getGPS"
,
param
,
function
(
data
,
responseCallback
)
{
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment