147d44a450
Replaces the use of a query-string parameter with a (once-per-session) JS-to-Java function call, because query-string parameters on file:// URLs are busted on ICS and earlier Android releases (https://code.google.com/p/android/issues/detail?id=17535). Also added channel.html to the list of inputs to cause edits to it to cause a rebuild of the .apk. BUG=1949 R=wu@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1890004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4421 4adac7df-926f-26a2-2b94-8c16560cd09d
35 lines
1.2 KiB
HTML
35 lines
1.2 KiB
HTML
<html>
|
|
<head>
|
|
<script src="https://apprtc.appspot.com/_ah/channel/jsapi"></script>
|
|
</head>
|
|
<!--
|
|
Helper HTML that redirects Google AppEngine's Channel API to a JS object named
|
|
|androidMessageHandler|, which is expected to be injected into the WebView
|
|
rendering this page by an Android app's class such as AppRTCClient.
|
|
-->
|
|
<body onbeforeunload="closeSocket()" onload="openSocket()">
|
|
<script type="text/javascript">
|
|
var token = androidMessageHandler.getToken();
|
|
if (!token)
|
|
throw "Missing/malformed token parameter: [" + token + "]";
|
|
|
|
var channel = null;
|
|
var socket = null;
|
|
|
|
function openSocket() {
|
|
channel = new goog.appengine.Channel(token);
|
|
socket = channel.open({
|
|
'onopen': function() { androidMessageHandler.onOpen(); },
|
|
'onmessage': function(msg) { androidMessageHandler.onMessage(msg.data); },
|
|
'onclose': function() { androidMessageHandler.onClose(); },
|
|
'onerror': function(err) { androidMessageHandler.onError(err.code, err.description); }
|
|
});
|
|
}
|
|
|
|
function closeSocket() {
|
|
socket.close();
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|