Android API version 31 (Android S) and above require any PendingIntent
to have one of two flags set: FLAG_IMMUTABLE
or FLAG_MUTABLE
. (Android doc.) ServerPingWithAlarmManager.onCreate
doesn’t do this, and so is throwing an IllegalArgumentException.
(ServerPingWithAlarmManager
uses the flag 0
when creating a PendingIntent
to pass to AlarmManager
.)
java.lang.IllegalArgumentException: com.<app package name>: 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.jivesoftware.smackx.ping.android.ServerPingWithAlarmManager.onCreate(ServerPingWithAlarmManager.java:166)
In order for ServerPingWithAlarmManager
to work on apps targeting Android S and above, it’ll need to be updated to use one of those flags instead of 0.