AndroidUSBCamera
AndroidUSBCamera copied to clipboard
Play store release minimum targetSdkVersion 31.
As per the latest google play store policy minimum targetSdkVersion is API level 31 but I'm not able to run app by using this API level so how can i fix this issue ?
Is maybe a problem of "mutable flag" stuff? I had the same issue, but i've solved it
How you solved it ?
As per the latest google play store policy minimum
targetSdkVersionis API level 31 but I'm not able to run app by using this API level so how can i fix this issue ?
which version, the newest version opt like this:
public synchronized void register() throws IllegalStateException {
if (destroyed) throw new IllegalStateException("already destroyed");
if (mPermissionIntent == null) {
if (DEBUG) XLogWrapper.i(TAG, "register:");
final Context context = mWeakContext.get();
if (context != null) {
if (Build.VERSION.SDK_INT >= 31) {
// avoid acquiring intent data failed in receiver on Android12
// when using PendingIntent.FLAG_IMMUTABLE
// because it means Intent can't be modified anywhere -- jiangdg/20220929
int PENDING_FLAG_IMMUTABLE = 1<<25;
mPermissionIntent = PendingIntent.getBroadcast(context, 0, new Intent(ACTION_USB_PERMISSION), PENDING_FLAG_IMMUTABLE);
} else {
mPermissionIntent = PendingIntent.getBroadcast(context, 0, new Intent(ACTION_USB_PERMISSION), 0);
}
final IntentFilter filter = new IntentFilter(ACTION_USB_PERMISSION);
// ACTION_USB_DEVICE_ATTACHED never comes on some devices so it should not be added here
filter.addAction(ACTION_USB_DEVICE_ATTACHED);
filter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED);
context.registerReceiver(mUsbReceiver, filter);
}
// start connection check
mDeviceCounts = 0;
mAsyncHandler.postDelayed(mDeviceCheckRunnable, 1000);
}
}
@jiangdongguo Still unable to access the usb camera in devices with sdk 29 and below, if targetSdk is set to 31.