From b054841f1ff871926ecaa67dff6f0af87eadccb2 Mon Sep 17 00:00:00 2001 From: rafaelgustavo123 <76185084+rafaelgustavo123@users.noreply.github.com> Date: Sun, 15 May 2022 16:49:39 -0300 Subject: [PATCH 1/2] Update PdService.java PendingIntent bug on android 12. Please, add this changes. --- .../java/org/puredata/android/service/PdService.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/PdCore/src/main/java/org/puredata/android/service/PdService.java b/PdCore/src/main/java/org/puredata/android/service/PdService.java index fbab2d03..819a3b50 100644 --- a/PdCore/src/main/java/org/puredata/android/service/PdService.java +++ b/PdCore/src/main/java/org/puredata/android/service/PdService.java @@ -241,8 +241,15 @@ private Notification makeNotification(Intent intent, int icon, String title, Str notificationManager.createNotificationChannel(channel); } } - - PendingIntent pi = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0); + + 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); + } + return new NotificationCompat.Builder(PdService.this, TAG) .setSmallIcon(icon) .setContentTitle(title) From f2c645cb1e3f81acbd8139093eeef501ffe4a3f1 Mon Sep 17 00:00:00 2001 From: rafaelgustavo123 <76185084+rafaelgustavo123@users.noreply.github.com> Date: Tue, 17 May 2022 09:04:29 -0300 Subject: [PATCH 2/2] Update PdCore/src/main/java/org/puredata/android/service/PdService.java Co-authored-by: Tal Kirshboim --- .../src/main/java/org/puredata/android/service/PdService.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PdCore/src/main/java/org/puredata/android/service/PdService.java b/PdCore/src/main/java/org/puredata/android/service/PdService.java index 819a3b50..70236219 100644 --- a/PdCore/src/main/java/org/puredata/android/service/PdService.java +++ b/PdCore/src/main/java/org/puredata/android/service/PdService.java @@ -245,8 +245,7 @@ private Notification makeNotification(Intent intent, int icon, String title, Str 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 { + } else { pi = PendingIntent.getActivity(getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); }