Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

428
Vistas
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent, On AlarmPingSender

Problem

Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. I got it after updating target SDK to 31. the error always come after AlarmPingSender. But i dont know any class that used AlarmPingSender.


2021-10-31 10:43:04.990 17031-17341/com.app.mobile D/AlarmPingSender: Register alarmreceiver to MqttServiceMqttService.pingSender.com.app.mobile-2e24ccbde048f2e91635651784
2021-10-31 10:43:04.993 17031-17341/com.app.mobile E/AndroidRuntime: FATAL EXCEPTION: MQTT Rec: com.app.mobile-2e24ccbde048f2e91635651784
    Process: com.app.mobile, PID: 17031
    java.lang.IllegalArgumentException: com.app.mobile: 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, 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:1150)
        at org.eclipse.paho.client.mqttv3.internal.ClientState.notifyReceivedAck(ClientState.java:987)
        at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:118)
        at java.lang.Thread.run(Thread.java:920)

What I Already done

  • Upgrade WorkManager to 2.7.0
  • set AllProject to force use WorkManager to 2.7.0
  • change all existing PendingIntent to use FLAG_IMMUTABLE
  • there's old code that still use gcm and disable it
  • Updating all Firebase package (some said its because of later version of analytics)

Library Used

  • OneSignal
  • Qiscus
  • Firebase
  • WorkManager
over 4 years ago · Hanz Gallego
7 Respuestas
Responde la pregunta

0

Try adding alarm permission

<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
over 4 years ago · Hanz Gallego Denunciar

0

in addition to others' answers I changed :

implementation 'com.google.firebase:firebase-messaging:20.0.0'

to :

implementation 'com.google.firebase:firebase-messaging:23.0.0'

and its working now.

over 4 years ago · Hanz Gallego Denunciar

0

This might be the issue with the library version. If you have older version libraries in your project then you have to update it to the latest version.

So, update the work runtime and firebase messaging library version as follows,

dependencies {
    // For Java
    implementation 'androidx.work:work-runtime:2.7.1' 
    // For Kotlin
    implementation 'androidx.work:work-runtime-ktx:2.7.1'
    implementation 'com.google.firebase:firebase-messaging:23.0.0'
    ...
}

Also, ensure that the pending intent code is something like this,

PendingIntent pendingIntent = PendingIntent.getActivity(this, alarmID, notificationIntent, PendingIntent.FLAG_IMMUTABLE);
over 4 years ago · Hanz Gallego Denunciar

0

I had this crash but no 3rd party libraries. Adding this import with the latest version will fix the crash.

implementation 'androidx.work:work-runtime-ktx:2.7.0-beta01'
over 4 years ago · Hanz Gallego Denunciar

0

After several attempt to fix this, i gave up and try to contact Qiscus. And they release new version that handle this Pending Intent behaviour change. So if anyone use Qiscus and got this error, you can use latest tag

https://github.com/qiscus/qiscus-sdk-android/releases/tag/1.3.35

over 4 years ago · Hanz Gallego Denunciar

0

Add the following to your build.gradle(app) dependencies.

dependencies {
  // For Java
  implementation 'androidx.work:work-runtime:2.7.1' 

  // For Kotlin
  implementation 'androidx.work:work-runtime-ktx:2.7.1'
}
over 4 years ago · Hanz Gallego Denunciar

0

Possible solution

Upgrade google analytics to firebase analaytics. Hope it'll solve your problems.Also upgrade all the library what're you using.

For me below solutions solve the problem.

Add PendingIntent.FLAG_IMMUTABLE to your pending intents.

Here is an example -

PendingIntent pendingIntent = PendingIntent.getActivity(this, alarmID, notificationIntent, PendingIntent.FLAG_IMMUTABLE);

For further information follow this link - https://developer.android.com/reference/android/app/PendingIntent#FLAG_IMMUTABLE

over 4 years ago · Hanz Gallego Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda