saki4510t / UVCPermissionTest

Test app to confirm whether or not app can get USB permission for UVC device with verious target SDK version
Apache License 2.0
25 stars 3 forks source link

Usb Permissions #1

Open Peter-St opened 4 years ago

Peter-St commented 4 years ago

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

saki4510t commented 4 years ago

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.

Peter-St commented 4 years ago

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

shenyaocn commented 4 years ago

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.

Peter-St commented 4 years ago

Hello Shenyaocn,

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

So far,

Peter

saki4510t commented 4 years ago

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

saki

Peter-St commented 4 years ago

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 commented 4 years ago

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

saki4510t commented 4 years ago

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.

Peter-St commented 4 years ago

Ok, that sounds sane. Thanks for the rectification

Peter-St commented 4 years ago

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

saki4510t commented 4 years ago

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)

shenyaocn commented 4 years ago

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

Peter-St commented 4 years ago

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

heaveninfosoft commented 2 years ago

@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

Peter-St commented 2 years ago

Update:

I got the following answer from Google: Am 26. Apr. 2022, um 17:48, googleplay-developer-support@google.com 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:

Mahe2027 commented 2 years ago

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

Peter-St commented 2 years ago

Hi,

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

Sumeyya-Eser commented 2 years ago

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 ?

Peter-St commented 2 years ago

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

AdyStudios commented 1 year ago

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

Peter-St commented 1 year ago

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.

AshikLanjewar commented 3 months ago

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