-
Notifications
You must be signed in to change notification settings - Fork 861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App crashing due to PendingIntent flag FLAG_IMMUTABLE on targetting API 31 SDK #465
Comments
I have the same situation as you |
Same here. Should be a very simple fix, but looking at the commit history, I am wondering if there will be any or if it is time to migrate to something else... |
I have the same situation as you |
Did you tried this more modern repo https://github.com/hannesa2/paho.mqtt.android ? |
@hannesa2 Are you sure your library won't reproduce the same error? |
@rushsports When you found an error, I would merge the pull request. But first I want to see the error on my tests |
@hannesa2 it is reproducible. From android 12 it is mandatory to set FLAG_IMMUTABLE or FLAG_MUTABLE for a PendingIntent. |
@JorisBodin Please show me a failing test. I don't see it |
@hannesa2 You can compile and launch our application on Android 12, as soon as it connects to MQTT the application crashes ... |
Probably your app will crash, but why mine not. Where is the diff ? |
on Android 12 device? |
Anyway, switch to my repo (it's not this one !), make a pull request there and we will solve it. |
Ahh, there is the diff |
Here you have the fix for Android 12 (api 31) |
Is there anyone solved? |
Use the fork of @hannesa2, the problem is fixed |
I have the same problem |
Same here! |
I followed your solution as below : 1- Imported serviceLibrary_release.aar (added in libs directory) in build.gradle : Voila , Build output : |
@mohammadfazelp I don't know what I should do here in this dead repo. Maybe you give my fork a try ? |
@mohammadfazelp @movaffagh @mukul29 |
thank you |
My app was forced to upgrade to Target 31. I encountered this problem and couldn't wait for the new version. I just forked and repackaged the version myself. Update content: For specific modifications, please see: https://github.com/bingerz/flip-mqtt-android |
@hannesa2 I am facing an issue with your fork also. |
Will there be an official release from org.eclipse.paho.android with a fix for this android-12 issue? |
I have the same situation as you |
same here |
1 similar comment
same here |
how can we try to get this officially merged? |
@hannesa2 Hello, I installed your library, a new error started popping up, here it is:"Exception 'org.eclipse.paho.client.mqttv3.MqttException' is never thrown in the corresponding try block".Tell me what to do with it. |
Please fill out the form below before submitting, thank you!
__Android API Version Bug Seen on: API 31
__Android Version Bug Seen on: Android 12
Please also check that if you have found the bug in the Release version (1.1.1) that you check that it also exists in the Snapshot (1.1.2-SNAPSHOT) before raising a bug.
Description of Bug:
Just initialize mqtt connection on a Android API 31 version device and you will get this exception. I have done this on Pixel 4A API S device.
I'm using the following dependency -
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5'
implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
Console Log output (if available):
java.lang.IllegalArgumentException: Targeting S+ (version 10000 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
at org.eclipse.paho.android.service.AlarmPingSender.start(AlarmPingSender.java:76)
at org.eclipse.paho.client.mqttv3.internal.ClientState.connected(ClientState.java:1214)
at org.eclipse.paho.client.mqttv3.internal.ClientState.notifyReceivedAck(ClientState.java:1050)
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:151)
The text was updated successfully, but these errors were encountered: