gpt4 book ai didi

java - Android pei 的sinch视频通话摄像头权限问题(9)

转载 作者:行者123 更新时间:2023-12-02 10:17:08 29 4
gpt4 key购买 nike

更新

我正在开发一个需要相机权限的小应用程序。我可以处理运行时权限,但真正的问题是当我中继到 Sinchpayload 并转到传入调用 Activity 时。此 Activity 应请求权限(相机和其他 2 个权限)。但它没有显示权限对话框,而是由于安全异常而使我的应用程序崩溃。 仅当我请求相机权限时才会发生这种情况 - 其他权限不会发生这种情况,并且仅在具有相机“2”Api 的 Android 9 上 - Android 8.1 及更低版本工作正常使用 SINCH 示例推送时仍然会出现此问题。权限对话框将显示是否像往常一样有意开始 Activity 。这是错误:

-------- beginning of crash
2019-02-10 22:11:55.390 2113-2681/com.example.myapp.app E/AndroidRuntime: FATAL EXCEPTION: VideoCapturerThread
Process: com.example.myapp.app, PID: 2113
java.lang.SecurityException: validateClientPermissionsLocked:1054: Caller "com.example.myapp.app" (PID 10319, UID 2113) cannot open camera "1" without camera permission
at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:747)
at android.hardware.camera2.CameraManager.openCameraDeviceUserAsync(CameraManager.java:405)
at android.hardware.camera2.CameraManager.openCameraForUid(CameraManager.java:567)
at android.hardware.camera2.CameraManager.openCamera(CameraManager.java:495)
at org.webrtc.Camera2Session.openCamera(Unknown Source:44)
at org.webrtc.Camera2Session.start(Unknown Source:60)
at org.webrtc.Camera2Session.<init>(Unknown Source:73)
at org.webrtc.Camera2Session.create(Unknown Source:17)
at org.webrtc.Camera2Capturer.createCameraSession(Unknown Source:17)
at org.webrtc.CameraCapturer$5.run(Unknown Source:52)
at android.os.Handler.handleCallback(Handler.java:891)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:207)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: android.os.ServiceSpecificException: validateClientPermissionsLocked:1054: Caller "com.example.myapp.app" (PID 10319, UID 2113) cannot open camera "1" without camera permission (code 1)
at android.os.Parcel.createException(Parcel.java:1967)
at android.os.Parcel.readException(Parcel.java:1921)
at android.os.Parcel.readException(Parcel.java:1871)
at android.hardware.ICameraService$Stub$Proxy.connectDevice(ICameraService.java:343)
at android.hardware.camera2.CameraManager.openCameraDeviceUserAsync(CameraManager.java:369)
at android.hardware.camera2.CameraManager.openCameraForUid(CameraManager.java:567) 
at android.hardware.camera2.CameraManager.openCamera(CameraManager.java:495) 
at org.webrtc.Camera2Session.openCamera(Unknown Source:44) 
at org.webrtc.Camera2Session.start(Unknown Source:60) 
at org.webrtc.Camera2Session.<init>(Unknown Source:73) 
at org.webrtc.Camera2Session.create(Unknown Source:17) 
at org.webrtc.Camera2Capturer.createCameraSession(Unknown Source:17) 
at org.webrtc.CameraCapturer$5.run(Unknown Source:52) 
at android.os.Handler.handleCallback(Handler.java:891) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:207) 
at android.os.HandlerThread.run(HandlerThread.java:65)`

这是我请求权限的代码:

if (Build.VERSION.SDK_INT>=23)
{
if (GlobalConstants.isAllPermissionsGrantedBefore_Video_Call(this)==false)
ActivityCompat.requestPermissions(
Video_incomming_call.this,
GlobalConstants.mPermissions_Video_Chat,
GlobalConstants.VIDEO_RECIEVE_CODE);
else {
Start_Calling();
}

} else Start_Calling();

最佳答案

应用程序权限对话框仅显示在前台。

关于java - Android pei 的sinch视频通话摄像头权限问题(9),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54607891/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com