RocketChat / Rocket.Chat.Cordova

Rocket.Chat Cross-Platform Mobile Application via Cordova (DEPRECATED)
MIT License
104 stars 109 forks source link

Android 6.0 Get Camera permission for WebRTC #78

Open jmatsushita opened 8 years ago

jmatsushita commented 8 years ago

Redirected from RocketChat/Rocket.Chat.Android#11 Seems implemented for iOS #29 but doesn't work for me on Android.

WebRTC works with the Android Chrome browser it would be great to have it on the Android app too! I guess that WebRTC broadcasts should probably also be using Push notifications.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

geekgonecrazy commented 8 years ago

WebRTC support is already on Android. What version of Android do you have and do are you using the latest from the play store, or compiling your self?

jmatsushita commented 8 years ago

I'm using Android 6.0.1 (In version 6 there's a new permissions API which require requesting access at runtime) and the latest app from the playstore (which also fetched an update recently - maybe because I updated our server side instance which tracks the develop branch - but it didn't work even before that).

superSp commented 7 years ago

how to solve it ? ..my camera is black.. what permission shoud i add ?~~~~ e....i think my permission have geted,but my camera always black, how to solve it ...

mrplow commented 7 years ago

Dupe of issue #1

sanjinmr commented 7 years ago

I have the same problem. When my application is running in the 6.0 version of the system, the camera has been shown in black. I have added all the required permissions. How do you solve this problem?

354420603 commented 7 years ago

I have the same problem, Who can tell me to solve this problem

ProfessorSr1974 commented 6 years ago

over a year and still no help - looks like i wasted a lot of my time on Rocket.Chat that I wont get back. I could have found something else to use. This is ridiculous. Several people have the same issue and it has been over a year - yet no resolution. Disgraceful.

sanwuwy commented 6 years ago

@ProfessorSr1974 , From Android5.0, WebView can support WebRTC. For Android6.0+, before you enter an activity which contains a WebView with WebRTC function, you should request the permissions(Manifest.permission.CAMERA and Manifest.permission.RECORD_AUDIO) first. Then you should override a method like this:

mWebView.setWebChromeClient(new WebChromeClient() {
@override
public void onPermissionRequest(final PermissionRequest request) {

    WebRTCActivity.this.runOnUiThread(new Runnable() {
        @TargetApi(Build.VERSION_CODES.LOLLIPOP)
        @Override
        public void run() {
            Log.i(TAG, "PermissionRequest = " + Arrays.toString(request.getResources()));
            request.grant(request.getResources());   // this code must execute
        }
    });

}
});
mWebView.loadUrl("your webrtc https address"); // http is not support
sandeep2244 commented 5 years ago

@sanwuwy I have used setWebChromeClient(Same as above code you providing) in my Android7.1.1 project but it shows error regarding classCastException I raised isuue in cordova-android but not any good response Its part of WEBRTC so you might be know very well

links of my problem in stack overflow and GITHUB

https://github.com/muaz-khan/WebRTC-Experiment/issues/604 https://stackoverflow.com/questions/52332133/setwebchromeclient-in-systemwebview-cant-override-in-android-webview