Skip to content

Handled Null Exceptions#31

Open
Jerinji2016 wants to merge 4 commits into
kechankrisna:masterfrom
Elaachi:fix/null_exception_handling
Open

Handled Null Exceptions#31
Jerinji2016 wants to merge 4 commits into
kechankrisna:masterfrom
Elaachi:fix/null_exception_handling

Conversation

@Jerinji2016
Copy link
Copy Markdown
Contributor

Changes

1. Changed USBPrinterAdapter to singleton class.

Previously, USBPrinterAdapter().getInstance() worked same as constructor instantiating.
Changed getInstance to static method and disposed the static instance on onDetachedFromEngine


2. mUsbDeviceReceiver receiver always receives null for usbDevice

Checked in Android 12 & 13, the intent extra for UsbManager.EXTRA_DEVICE is always null.
So, add the vendorId and productId to pendingIntent while requesting permissions.
If UsbManager.EXTRA_DEVICE is null, then try to init usb device with vendorId and productId.


3. Moved pendingIntent from class scope to local scope

Since pending intent is only required when requesting permission, moved variable to local scope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant