cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject android commit: CB-9115 android: Grant Lollipop permission req
Date Wed, 10 Jun 2015 18:53:40 GMT
Repository: cordova-android
Updated Branches:
  refs/heads/master 505db3823 -> eb70f0516

CB-9115 android: Grant Lollipop permission req

This patch overrides onPermissionRequest so that getUserMedia can be
used inside the browser.

Since a hybrid app has to request permissions anyways via
AndroidManifest.xml, I think it is unnecessary to have any further
configuration for onPermissionRequest. Anything that the app is allowed
to do should be possible from the JS side. Hence all requests are
granted. This enables getUserMedia (and WebRTC) on Android Lollipop,
without resorting to crosswalk.

The docs say that request.grant has to be called from the UI thread, but
don't explicitly spell out whether onPermissionRequest is called from
the UI thread. I think that this is so, the WebChromeClient of course
makes its calls from the UI thread unless otherwise noted. So there is
no need to post a runnable to the UI thread.

This closes 178


Branch: refs/heads/master
Commit: eb70f05168dcf3a07d8716c772db3a3c3c3a59f8
Parents: 505db38
Author: Volker Braun <>
Authored: Wed Jun 3 22:59:49 2015 +0200
Committer: Joe Bowser <>
Committed: Wed Jun 10 11:53:03 2015 -0700

 .../org/apache/cordova/engine/    | 9 +++++++++
 1 file changed, 9 insertions(+)
diff --git a/framework/src/org/apache/cordova/engine/ b/framework/src/org/apache/cordova/engine/
index 7b6c883..3b5866c 100755
--- a/framework/src/org/apache/cordova/engine/
+++ b/framework/src/org/apache/cordova/engine/
@@ -18,6 +18,7 @@
 package org.apache.cordova.engine;
+import java.util.Arrays;
 import android.annotation.TargetApi;
 import android.content.ActivityNotFoundException;
@@ -36,6 +37,7 @@ import android.webkit.ValueCallback;
 import android.webkit.WebChromeClient;
 import android.webkit.WebStorage;
 import android.webkit.WebView;
+import android.webkit.PermissionRequest;
 import android.widget.LinearLayout;
 import android.widget.ProgressBar;
 import android.widget.RelativeLayout;
@@ -266,6 +268,13 @@ public class SystemWebChromeClient extends WebChromeClient {
         return true;
+    @Override
+    public void onPermissionRequest(final PermissionRequest request) {
+        Log.d(LOG_TAG, "onPermissionRequest: " + Arrays.toString(request.getResources()));
+        request.grant(request.getResources());
+    }
     public void destroyLastDialog(){

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message