okhiroyuki / cordova-plugin-usb-serial

Cordova/Phonegap plugin for USB host serial communication from an Android device.
https://www.npmjs.com/package/@red-mobile/cordova-plugin-usb-serial
MIT License
3 stars 6 forks source link

Android 14 Permission Issue #39

Open rexn8r opened 2 months ago

rexn8r commented 2 months ago

Hi

Does this plugin work on Android 14 with change in the way permissions are handled?

I can't bypass the requestPermission call. I tried following comment from @cordovarduino project issues but no Luck!

https://github.com/xseignard/cordovarduino/issues/31#issuecomment-93310108

how to solve this?

Thanks

zemrys commented 1 month ago

I had the same issue so I did some digging around and came up with this fix and it seems to be holding up on everything I've tested so far.

repo: https://github.com/zemrys/cordova-plugin-usb-serial

changes: https://github.com/okhiroyuki/cordova-plugin-usb-serial/compare/main...zemrys:cordova-plugin-usb-serial:main

rexn8r commented 1 month ago

hi @zemrys

Thanks for the repo.

I tried the suggestions to add the settings in the Androidmanifest.xml file but still the permission dialog appears on reboot.

https://github.com/xseignard/cordovarduino/issues/31#issuecomment-93310108

My Androidmanifest.xml contains following settings;

above

<activity android:directBootAware="true" ....

My device_filter.xml file contains following nodes (with VID and PID in decimal/integer value;

<?xml version="1.0" encoding="utf-8"?>

Now when I call the serial.requestPermission plugin function with following code, the serial communication works fine but when the device is rebooted, the permission box shows up again;

serial.requestPermission({ vid: '1A86', //hex value pid: '7523', driver: 'Ch34xSerialDriver' // or any other }

If I try to use the VID and PID as integer as follows, 'No Device' found error comes up.

serial.requestPermission({ vid: 6790, //integer value pid: 7523, driver: 'Ch34xSerialDriver' // or any other }

how to resolve the issue?

Thanks R