eclipse / paho.mqtt.android

MQTT Android
Other
2.88k stars 862 forks source link

Fixing pendingintent for A12 #471

Open tronku opened 2 years ago

tronku commented 2 years ago

Please make sure that the following boxes are checked before submitting your Pull Request, thank you!

hannesa2 commented 2 years ago

It's the same like https://github.com/eclipse/paho.mqtt.android/pull/466

tronku commented 2 years ago

@hannesa2 still both are not merged or reviewed, this library is not being maintained properly in spite of high usage

hannesa2 commented 2 years ago

@tronku Did you see there this https://github.com/eclipse/paho.mqtt.android/pull/466#issuecomment-1019429898 ?

tronku commented 2 years ago

@hannesa2 will have to check your implementation, can't directly switch from eclipse paho although I solved the issue for myself by reusing the entire code with the minor flag change

Benjamin410 commented 2 years ago

@tronku Could you explain me how I can use your fixed version instead of the official version? Thanks!!!

tronku commented 2 years ago

@Benjamin410 i copied all the files of mqtt in my project and just changed the pending intent flags.

shivamdhammi-winzo commented 2 years ago

@tronku @hannesa2 changing these flags is giving me the error mentioned below:

Fatal Exception: java.lang.SecurityException: Caller needs to hold android.permission.SCHEDULE_EXACT_ALARM to set exact alarms. at android.os.Parcel.createExceptionOrNull(Parcel.java:2437) at android.os.Parcel.createException(Parcel.java:2421) at android.os.Parcel.readException(Parcel.java:2404) at android.os.Parcel.readException(Parcel.java:2346) at android.app.IAlarmManager$Stub$Proxy.set(IAlarmManager.java:395) at android.app.AlarmManager.setImpl(AlarmManager.java:976) at android.app.AlarmManager.setImpl(AlarmManager.java:936) at android.app.AlarmManager.setExactAndAllowWhileIdle(AlarmManager.java:1204) at info.mqtt.android.service.ping.AlarmPingSender.schedule(AlarmPingSender.kt:86) at info.mqtt.android.service.ping.AlarmPingSender.start(AlarmPingSender.kt:57) 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) at java.lang.Thread.run(Thread.java:920)

tronku commented 2 years ago

Yes @shivamdhammi-winzo This permission is needed to be mentioned in the manifest for A12 devices

pricimus commented 2 years ago

Is this branch going to get merged? It's passed all checks and without it, it's holding up the ability to upgrade target sdk versions.

LordBaryhobal commented 1 year ago

Thanks for this easy fix, it works perfectly. I hope it can be merged soon