libpd / pd-for-android

Pure Data for Android
353 stars 91 forks source link

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

Closed rafaelgustavo123 closed 1 year ago

rafaelgustavo123 commented 2 years ago

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); }

joebowbeer commented 2 years ago

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