You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've been using the plugin just fine for around a year, and now all of sudden a specific user reported our app is crashing when portDiscovery() is called with a USB printer connected.
Investigating the Android logs (with wireless adb + «app_root_folder»/platforms/android/cordova/log), I found the following error User has not given «id»/«app.key» permission to access device /dev/bus/usb/001/002 (full log at the end). I see no information on permissions at the plugin README, nor information on how to request these permissions from Cordova. Also found nothing besides Bluetooth permissions in source code...
This was noticed on multiple Android devices, all running Android 11. There were no recent updates in either code or OS, not that we recall. cordova-plugin-starprnt was used at 2.2.0 and 2.1.0, both cause the same error.
That said, it seems to work fine on Android 7, but the device only asks for permission when actually sending a print job. Printer search worked normally, without requesting permissions.
add USB permissions to Android's Manifest - works but suboptimal, since it requires the user to first plug the printer, then select our app in the popup that shows. The following scenarios still cause the app to crash when a printer is connected:
if the user closes the permission popup;
if the user selects another app (e.g. Star Quick Setup Utility);
or even if that was done previously but not with the "always" option.
a couple of forks seem to include updated versions of the SDK all of them have the same issue
I was definitely not able to, but got something done at my fork. The app requests to be opened once the printer is plugged, as suggested in this StarPRNT SDK guide (same as 2nd check above), but I couldn't get properpermissionJava code running
check if other StarPrinter plugins have correct permissions or if we could use them instead
Full exception
FATAL EXCEPTION: pool-2-thread-1
Process: com.xyz.abc, PID: 25787
java.lang.SecurityException: User has not given 10697/com.xyz.abc permission to access device
at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
at android.os.Parcel.createException(Parcel.java:2357)
at android.os.Parcel.readException(Parcel.java:2340)
at android.os.Parcel.readException(Parcel.java:2282)
at android.hardware.usb.IUsbSerialReader$Stub$Proxy.getSerial(IUsbSerialReader.java:123)
at android.hardware.usb.UsbDevice.getSerialNumber(UsbDevice.java:157)
at com.starmicronics.stario.e.b(Unknown Source:43)
at com.starmicronics.stario.e.a(Unknown Source:0)
at com.starmicronics.stario.StarIOPort.searchPrinter(Unknown Source:49)
at starprnt.cordova.StarPRNT.getPortDiscovery(StarPRNT.java:268)
at starprnt.cordova.StarPRNT.access$000(StarPRNT.java:58)
at starprnt.cordova.StarPRNT$2.run(StarPRNT.java:223)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.usb.UsbUserPermissionManager.checkPermission(UsbUserPermissionManager.java:654)
at com.android.server.usb.UsbSerialReader.getSerial(UsbSerialReader.java:98)
at android.hardware.usb.IUsbSerialReader$Stub.onTransact(IUsbSerialReader.java:84)
at android.os.Binder.execTransactInternal(Binder.java:1165)
at android.os.Binder.execTransact(Binder.java:1134)
Any help is greatly appreciated!
The text was updated successfully, but these errors were encountered:
igorsantos07
added a commit
to igorsantos07/cordova-plugin-starprnt
that referenced
this issue
Jun 6, 2022
I was able to include the permission XML that allows any app to "respond" to a just-plugged printer, but......... not more than that.
Any Java code I included (even blatantly broken stuff) never caused an issue during compilation or runtime, not more than the current bug causes. No clue how to actually compile the plugin and get it into the debug app.
This is supposed to be a solution for auctifera-josed#58
igorsantos07
added a commit
to igorsantos07/cordova-plugin-starprnt
that referenced
this issue
Jun 6, 2022
I was able to include the permission XML that allows any app to "respond" to a just-plugged printer, but......... not more than that. Some changes on the iOS side was done too, but that was easier since it's simply a no-op (and is untested too).
Any Java code I included (even blatantly broken stuff) never caused an issue during compilation or runtime, not more than the current bug causes. No clue how to actually compile the plugin and get it into the debug app.
This is supposed to be a solution for auctifera-josed#58
We've been using the plugin just fine for around a year, and now all of sudden a specific user reported our app is crashing when
portDiscovery()
is called with a USB printer connected.Investigating the Android logs (with wireless adb +
«app_root_folder»/platforms/android/cordova/log
), I found the following errorUser has not given «id»/«app.key» permission to access device /dev/bus/usb/001/002
(full log at the end). I see no information on permissions at the plugin README, nor information on how to request these permissions from Cordova. Also found nothing besides Bluetooth permissions in source code...This was noticed on multiple Android devices, all running Android 11. There were no recent updates in either code or OS, not that we recall.
cordova-plugin-starprnt
was used at 2.2.0 and 2.1.0, both cause the same error.That said, it seems to work fine on Android 7, but the device only asks for permission when actually sending a print job. Printer search worked normally, without requesting permissions.
Other things we tried:
look for the permission code in Java: didn't find anything similar to what's suggested in Android guidesa couple of forks seem to include updated versions of the SDKall of them have the same issueFull exception
Any help is greatly appreciated!
The text was updated successfully, but these errors were encountered: