Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.8K
Views
Android paho mqtt bloquea Android 12: la orientación a S+ (versión 31 y superior) requiere uno de FLAG_IMMUTABLE o FLAG_MUTABLE

Estoy usando 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5' para el servicio mqtt y la aplicación sigue fallando en dispositivos Android 12 con los siguientes registros de bloqueo

 java.lang.IllegalArgumentException: app id: Targeting S+ (version 31 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, eg if it needs to be used with inline replies or bubbles. at android.app.PendingIntent.checkFlags(PendingIntent.java:382) at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:673) at android.app.PendingIntent.getBroadcast(PendingIntent.java:660) 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)

Esta es la biblioteca que estoy usando:

 implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5' implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Actualice la biblioteca de firebase:

plataforma de implementación('com.google.firebase:firebase-bom:29.1.0') implementación 'com.google.firebase:firebase-messaging'

y elimine la implementación 'com.google.firebase:firebase-messaging:23.0.0'

over 4 years ago · Santiago Trujillo Report

0

Debe reemplazar "PendingIntent.FLAG_ONE_SHOT" o "PendingIntent.FLAG_UPDATE_CURRENT" con "PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE"

ejemplo:

alarmIntent = PendingIntent.getBroadcast(context, 0, new Intent(context, AutostartReceiver.class), PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);

over 4 years ago · Santiago Trujillo Report

0

Si está utilizando la biblioteca MQTT, no se han actualizado para Android 12. Entonces, cuando usa Android 12 como la versión de destino, arroja un error en PendingIntent. Para una solución temporal, encontré una biblioteca que habían actualizado para que fuera compatible con Android 12. Biblioteca de servicios MQTT

Descargue "serviceLibrary-release.aar" y agréguelo a su proyecto. Luego elimine la dependencia "'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1" de Gradle. Use "importar info.mqtt.android.service.MqttAndroidClient" dondequiera que esté usando.

Cómo importar un archivo aar

Esto resolvió mis problemas de biblioteca MQTT.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!