AppRTCDemo: replace the use of query-string parameters for pre-JB devices.

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
This commit is contained in:
fischman@webrtc.org
2013-07-29 19:07:33 +00:00
parent 7694562805
commit 147d44a450
3 changed files with 18 additions and 28 deletions

View File

@@ -83,10 +83,11 @@ public class GAEChannelClient {
", desc: " + description);
}
});
proxyingMessageHandler = new ProxyingMessageHandler(activity, handler);
proxyingMessageHandler =
new ProxyingMessageHandler(activity, handler, token);
webView.addJavascriptInterface(
proxyingMessageHandler, "androidMessageHandler");
webView.loadUrl("file:///android_asset/channel.html?token=" + token);
webView.loadUrl("file:///android_asset/channel.html");
}
/** Close the connection to the AppEngine channel. */
@@ -106,10 +107,14 @@ public class GAEChannelClient {
private final Activity activity;
private final MessageHandler handler;
private final boolean[] disconnected = { false };
private final String token;
public ProxyingMessageHandler(Activity activity, MessageHandler handler) {
public
ProxyingMessageHandler(Activity activity, MessageHandler handler,
String token) {
this.activity = activity;
this.handler = handler;
this.token = token;
}
public void disconnect() {
@@ -120,6 +125,10 @@ public class GAEChannelClient {
return disconnected[0];
}
@JavascriptInterface public String getToken() {
return token;
}
@JavascriptInterface public void onOpen() {
activity.runOnUiThread(new Runnable() {
public void run() {