Closed HM-Houda closed 2 years ago
@HM-Houda I too have the same issue, did you found any solution?
Unfortunately, No
-- Houda MAAMATOU |Ingénieure R&D LOGIROAD 5, rue de l'Enclose 44118 La Chevrolière @.*** Tel: 07 81 53 25 77 vidéo [6]
Le 2021-10-26 14:35, deebashd a écrit :
@HM-Houda [1] I too have the same issue, did you found any solution?
-- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub [2], or unsubscribe [3]. Triage notifications on the go with GitHub Mobile for iOS [4] or Android [5].
[1] https://github.com/HM-Houda [2] https://github.com/jiangdongguo/AndroidUSBCamera/issues/343#issuecomment-951894668 [3] https://github.com/notifications/unsubscribe-auth/AL3TWOZ7Q7AL47VQXIKOPH3UI2N7VANCNFSM5CBWBO2Q [4] https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 [5] https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub [6] https://drive.google.com/open?id=1Nysc4E17Qgk2I2h3uATcNr2lFh5pIIV4
@HM-Houda
I found the solution, import the library as module and edit the file com.serenegiant.usb.common.AbstractUVCCameraHandler > Line No 371
Instead of case MSG_CAPTURE_STILL: //thread.handleCaptureStill((String)msg.obj); thread.handleStillPicture((String) msg.obj); break;
replace with case MSG_CAPTURE_STILL: thread.handleCaptureStill((String)msg.obj); //thread.handleStillPicture((String) msg.obj); break;
can u please tell me how to work with this code in a higher version(11/12) of android? The app does open on an android 11 device but the screen remains black.
@ashrafulislamdolon Right now Android 11 and 12 is not supporting requestPermission method, so it won't work when your targetsdk is 30 and above. Set your targetsdk to less than 30, requestPermission will work.
Note: If your targetsdk is less than 30, you can't update or deploy your app in Google Playstore from November 1, 2021. If you really want to give USB camera feature to your users, you have to ask them download from your website not from Playstore.
In Android forum, they mentioned about deploying fix in Android 12, but it's not rolled out yet.
@deebashd with the current setting, the app opens in android 11 devices and it also connects to the camera but the screen remains black..how to solve this problem?? please help me
@deebashd hello..can u help me please??
@HM-Houda the app opens in android 11 but no preview is available..have you faced this problem??
@ashrafulislamdolon App will open without any problem, but you can't request permission when your app targets SDK 30 and above. Without permission, nothing will work. You can decrease the target SDK but you can't update the app to PlayStore instead you can make your user download APK directly from your website.
@deebashd this is the current setting- androidXVersion = '1.1.0' versionCompiler = 28 // when target=27, 9.0 is ok versionTarget = 27 // if hope supporting 4.4 // please modify it to 16 minSdkVersion = 16 versionCode = 101 versionNameString = '2.3.6.20211117' javaSourceCompatibility = JavaVersion.VERSION_1_8 javaTargetCompatibility = JavaVersion.VERSION_1_8
I can install and open this app in android 11 device but the camera preview is unavailable..
When you connect the USB camera to your phone running Android 11, does the phone pops up Permission request dialog automatically? And it should open your app automatically too.
And also please share your manifest.
@deebashd yes, a permission request pops up when I connect the camera.
here is the manifest file-
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.jiangdg.usbcamera">
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.usb.host"/>
<application
android:name=".application.MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="com.jiangdg.usbcamera.view.SplashActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".view.USBCameraActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
</intent-filter>
</activity>
</application>
I am using the same code given here-
<activity android:name=".camera.MainActivity">
<intent-filter>
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
<action android:name="android.hardware.usb.action.USB_ACCESSORY_DETACHED" />
</intent-filter>
<meta-data
android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="@xml/accessory_filter" />
</activity>
Add the above lines in your manifest and replace the activity name. This will open up your app when USB camera is connected to your Phone. Uninstall if any other USB camera apps in your phone.
You can remove meta-data of accessory_filter if you don't know the manufacturer or model related data. accessory_filter.xml
<!--?xml version="1.0" encoding="utf-8"?-->
<resources>
<usb-accessory manufacturer="vonchenchen" model="android.usbaoa" version="0.1"></usb-accessory>
</resources>
hello @deebashd
I tried what u said, but still facing the same old problem. the app shows no preview of the camera even though it connects. I've added the screenshots, please have a look .
Sorry, I can't suggest further, the problem might be in the code. For me, it's working good in Android 10 & 11. Please ask this in StackOverflow.
@deebashd can you share your full code please?
@deebashd maybe I found the problem..the code works with the devices that have Level 3 camera2 API support can u tell me how to make it work with Full/Limited Camera2 API support?
@ashrafulislamdolon Sorry, I can't share the code. Please ask code related question in StackOverflow
Please update to new (3.0), and have a try.
Hi everyone, I've just cloned the projet and compiled it. I generated a signed apk, however after installation on smartphone with Android 9. I can view camera but the options of take picture and recording don't work.
Any help would be appreciated. Thank you very much