libpd/pd-for-android

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

rafaelgustavo123 opened this issue · 1 comments

It is not working on android version 31+.
Need to change https://github.com/libpd/pd-for-android/blob/master/PdCore/src/main/java/org/puredata/android/service/PdService.java#L245 to something like this:

PendingIntent pi = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
pi = PendingIntent.getActivity(getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
}
else {
pi = PendingIntent.getActivity(getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}

Background and link to article: https://stackoverflow.com/q/67045607/901597