UVCPermissionTest icon indicating copy to clipboard operation
UVCPermissionTest copied to clipboard

Usb Permissions

Open Peter-St opened this issue 5 years ago • 22 comments

Hello Saki,

I'm having an UVC Camera app on Play Store (SDK 28 compiled) where Android 9 and 10 Users are unable to get Usb Permissions. Compiling it with SDK 27 (at least with Pixel 2 on Android 10 Q and no camera permission in manifest) I can still grant permission to the Usb camera. The problem here is, that for updating Apps on Play Store, the SDK version needs to be at least 27, otherwise it gets blocked.

Can you give any advices to me, for publishing the app also for Android 9 + 10 on Play Store? Or have you found any solutions for dealing with the new Google Usb Permissions up to now?

Thanks,

Peter

Peter-St avatar Dec 26 '19 01:12 Peter-St

Hi, Peter Android 9 and more need CAMERA permission to get USB permission for UVC devices. And unfortunately Android 10 has critical issue on granting USB permission now, pls check Issue Tracker, Still unable to get USB Video device permission on Android 10

As I tested and as I can see AOSP sources, currently there is no way to grant USB permission on Android 10 if targetAPI>=28 until Google and device vendor(s) fix the issue and update their firmeware.

saki4510t avatar Dec 26 '19 04:12 saki4510t

Thanks for the fast reply,

sad to hear about the latest UVC camera security updates. I think I will contact Google itself about this and let you hear, if I'll get some response.

So far,

Peter

Peter-St avatar Dec 26 '19 04:12 Peter-St

Hi, I have contacted Google developer and described about the issue as what I say in Still unable to get USB Video device permission on Android 10. And now they make a patch and tell me will be fixed on next update soon.

shenyaocn avatar Dec 26 '19 04:12 shenyaocn

Hello Shenyaocn,

great to hear that. Please come back to this issue, when they contact you.

So far,

Peter

Peter-St avatar Dec 26 '19 04:12 Peter-St

Hi @Peter-St, @shenyaocn Oh, It is one of a most good news in this year.

saki

saki4510t avatar Dec 26 '19 05:12 saki4510t

Update:

I'll got following request from the Google Play Developer Support:

Hi,

Thanks for contacting Google Play Developer Support to report the behavior you're seeing.

I’ve documented your issue and escalated it to our technical team for further investigation. Our team is working to resolve this issue for you as soon as possible.

I appreciate your patience and I’ll let you know the moment I have an update. Regards, Suraj Google Play Developer Support

Hope it wont last too long for them to fix it.

Happy New Year,

Peter

Peter-St avatar Dec 30 '19 16:12 Peter-St

Hello,

about the Usb Permissions on Android 10 there are still Apps on Play Store, updated in Oktober 2019, which can still grant Usb Permissions to Android 10 Devs like:

https://play.google.com/store/apps/details?id=com.shenyaocn.android.usbcamerapro

Anyone got an Idea how?

Thanks,

Peter

Peter-St avatar Jan 09 '20 08:01 Peter-St

I don't confirm well, but the target api of the app will be 27 or less, because it was possible to upload updated version of app that the target api level is 27(and less) to Google Play until end of October 2019.

saki4510t avatar Jan 09 '20 14:01 saki4510t

Ok, that sounds sane. Thanks for the rectification

Peter-St avatar Jan 09 '20 14:01 Peter-St

Hello again,

the Google Dev Support told me the following:

Hi,

Thanks for contacting Google Play Developer Support! I have checked and currently the matter is still in progress however I will update you once there is further information available.

Thanks for your patience in the meantime. Regards, Suraj Google Play Developer Support

I also made the suggestion to them to split the usb permissions from the Camera Api again, because it is still not logically in my mind for example when you think of a tablet with no camera (front or back camera), where you connect a usb webcam and you suddenly have to obtain permissions, which were not supported of the tablet device. The Uvc driver in my mind still has nothing to do with the Camera Api.

So far,

Peter

Peter-St avatar Jan 20 '20 19:01 Peter-St

Hi all, there is a good news today. I updated my Pixel3(Android 10) with monthly update of March 2020(Build QQ2A.200305.002) and I confirmed my Pixel3 can get USB permission for UVC devices even if I use app that target API level >= 28. (Unfortunately this still does not mean all Android 10 devices work well with UVC devices until their vendor update their devices)

saki4510t avatar Mar 12 '20 12:03 saki4510t

Yes, I use AOSP (android-10.0.0_r32) to build a ROM for Pixel XL and confirmed it can works.

shenyaocn avatar Mar 12 '20 12:03 shenyaocn

Hello,

a shot question about usb permissions on galaxy tab s5e (Android 9): I can grant the usb permissions and lunch the stream for yuv cameras on both SDK 27 and 28 build versions. But for MJPEG cameras lunching the stream fails on both platforms (But I can grant the Usb Permissions). When granting the permissions, only 1 camera Interface is available and so there is no way to start the camera. I also failed starting the camera with saki's usb camera app. With shenyaocn's app from the play store it's possible to start the cam and also with some others... Does someone knows here what I'm missing? My source code is at: https://github.com/Peter-St/Android-UVC-Camera

Thx, Peter

Peter-St avatar Apr 24 '20 17:04 Peter-St

@shenyaocn below is your app?

https://play.google.com/store/apps/details?id=com.shenyaocn.android.usbcamera

how it can work in all device hope you will help us

heaveninfosoft avatar Dec 23 '21 12:12 heaveninfosoft

Update:

I got the following answer from Google: Am 26. Apr. 2022, um 17:48, [email protected] schrieb: Hi, Thanks for your patience while our team investigated the behavior you experienced.

They have recently made some changes that should fix the problem. With the recent set of changes, please check to see if you are still experiencing the same issue. If so, I will be happy to see how else we can help.

Please let me know if you have any other questions or concerns about the Play Console.

Regards, Suraj Google Play Developer Support


Here are still 2 things which are worrying:

  1. Camera permissions needs to be granted to get the usb permissions on a digital usb camera.

  2. The last changes from Google still don't work on some devices:

  • BLU G90 Pro running Android 10 can't grant usb permissions above sdk27.....
  • But I think most devs work now (tryed some sony and samsung devs)

Peter-St avatar Jun 01 '22 20:06 Peter-St

hii my redmi9 isn't working with usb camera it's not taking permission weather my device (samsung galaxy A6+) is getting

any help will be appreciate. thanks

Regards, mahi

Mahe2027 avatar Jul 22 '22 10:07 Mahe2027

Hi,

on some android devices you are not able to get permissions above sdk30. Plz open a seperate Issue for your concern.

Peter-St avatar Aug 07 '22 09:08 Peter-St

Hello,

about the Usb Permissions on Android 10 there are still Apps on Play Store, updated in Oktober 2019, which can still grant Usb Permissions to Android 10 Devs like:

https://play.google.com/store/apps/details?id=com.shenyaocn.android.usbcamerapro

Anyone got an Idea how?

Thanks,

Peter

Hi Peter, do you have any update ?

Sumeyya-Eser avatar Aug 09 '22 06:08 Sumeyya-Eser

Usb permissions are restored from sdk 30 and above on most android devs.

Peter-St avatar Aug 09 '22 20:08 Peter-St

Any updates? I'm not really a dev just want to use my easy cap device, and I need help fixing the issue.

AdyStudios avatar Apr 22 '23 16:04 AdyStudios

Any updates? I'm not really a dev just want to use my easy cap device, and I need help fixing the issue.

Hi,

compiling this repo with the latest sdk you should be able to connect to your camera as usual. Be careful to grant the internal camera permissions also for usb camera devices since they were needed at Android 9 and above.

Peter-St avatar Apr 24 '23 10:04 Peter-St

Hi All, If anyone still facing the issue regarding request permission issue on Android sdk 28 and greater than that then follow below steps

  1. Add Extra Permission for device camera in manifest. Use below code: <uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:name="android.hardware.camera" android:required="true" />

  2. Before start USB or UVC camera, We have to check permission on runtime. If permission not granted then ask for the
    permission using below code

    private void checkCameraPermission() { // Add permission for camera and let user grant the permission if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_CAMERA_PERMISSION ); } }

  3. After responding on permission popup, If any stuff you have to execute on permission grant or denied then use below

    code snippet @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (requestCode == REQUEST_CAMERA_PERMISSION) { if (grantResults[0] == PackageManager.PERMISSION_DENIED) { //close the app Toast.makeText(this,"Sorry!!!, you won't be able to use this app smoothly without this permission.",Toast.LENGTH_LONG).show(); } } }

  4. Once user granted the above Camera permission, then request for USB_PERMISSION , it will work like Android SDK below 28.

    Please check android official link in details: Developer Website link

AshikLanjewar avatar Jul 02 '24 07:07 AshikLanjewar