监听postGPS事件
Showing
1 changed file
with
11 additions
and
0 deletions
| ... | @@ -86,6 +86,17 @@ AppClient.prototype.getGPS = function (jsonStr, callback) { | ... | @@ -86,6 +86,17 @@ AppClient.prototype.getGPS = function (jsonStr, callback) { |
| 86 | longitude = arr[1].split('=')[1] | 86 | longitude = arr[1].split('=')[1] |
| 87 | callback(latitude, longitude, responseCallback) | 87 | callback(latitude, longitude, responseCallback) |
| 88 | }) | 88 | }) |
| 89 | window.WebViewJavascriptBridge.callHandler('postGPS', function (data, responseCallback) { | ||
| 90 | isRes = true | ||
| 91 | var latitude = '' | ||
| 92 | var longitude = '' | ||
| 93 | var str = JSON.stringify(data) | ||
| 94 | var result = /\{([\s\S]*)\}/.exec(str); | ||
| 95 | var arr = result[1].split(',') | ||
| 96 | latitude = arr[0].split('=')[1] | ||
| 97 | longitude = arr[1].split('=')[1] | ||
| 98 | callback(latitude, longitude, responseCallback) | ||
| 99 | }) | ||
| 89 | } else { | 100 | } else { |
| 90 | this.appObj.registerHandler("postGPS", function (data, responseCallback) { | 101 | this.appObj.registerHandler("postGPS", function (data, responseCallback) { |
| 91 | 102 | ... | ... |
-
Please register or sign in to post a comment