Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Issue with SDK > 31 on Android 12 #360

Open
bdureau opened this issue Feb 4, 2023 · 3 comments
Open

Issue with SDK > 31 on Android 12 #360

bdureau opened this issue Feb 4, 2023 · 3 comments

Comments

@bdureau
Copy link

bdureau commented Feb 4, 2023

Looks like it does not request the permission correctly on Android 12.
You might be able to fix it like this
This is on line 155 on file SerialPortBuilder.java
//PendingIntent mPendingIntent = PendingIntent.getBroadcast(context, 0, new Intent(ACTION_USB_PERMISSION), 0);
PendingIntent mPendingIntent = null;
if(android.os.Build.VERSION.SDK_INT >= 31) {
mPendingIntent = PendingIntent.getBroadcast(context, 0, new Intent(ACTION_USB_PERMISSION), PendingIntent.FLAG_IMMUTABLE);
} else {
mPendingIntent = PendingIntent.getBroadcast(context, 0, new Intent(ACTION_USB_PERMISSION), 0);
}

Unfortunately I am having trouble to build the library so I cannot really test it.
I am quite happy to confirm if it works if someone explain how to build the lib
Regards
Boris

@bdureau
Copy link
Author

bdureau commented Feb 19, 2023

I have managed to recompile the library and it works
however I have had to add the following dependency for lib serial to work
implementation 'com.squareup.okio:okio:3.3.0'

@worldhugo
Copy link

Hi !

Can you share your lib version ?

@bdureau
Copy link
Author

bdureau commented Jan 10, 2025

mine is a bit messy but you could use the following fork which I am now using https://github.com/BeebLaser/UsbSerial

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants