Skip to content

Commit 8a7d67a

Browse files
fix: Crash when tapping on Notification action button in Android 12+ (#23)
* Fix Crash when tapping on Notification action button in Android 12 References: - OneSignal#1548 - https://outsystemsrd.atlassian.net/browse/RMET-3566 * chore(release): prepare for version 3.15.5-OS7 References: - https://outsystemsrd.atlassian.net/browse/RMET-3566
1 parent 1e83aab commit 8a7d67a

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

OneSignalSDK/onesignal/src/main/java/com/onesignal/NotificationOpenedProcessor.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ private static void handleDismissFromActionButtonPress(Context context, Intent i
7272
// Pressed an action button, need to clear the notification and close the notification area manually.
7373
if (intent.getBooleanExtra("action_button", false)) {
7474
NotificationManagerCompat.from(context).cancel(intent.getIntExtra(BUNDLE_KEY_ANDROID_NOTIFICATION_ID, 0));
75-
context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
75+
76+
// Only close the notifications shade on Android versions where it is allowed, Android 11 and lower.
77+
// See https://developer.android.com/about/versions/12/behavior-changes-all#close-system-dialogs
78+
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.S) {
79+
context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
80+
}
7681
}
7782
}
7883

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
<modelVersion>4.0.0</modelVersion>
88
<groupId>com.github.outsystems</groupId>
99
<artifactId>onesignal-android-sdk</artifactId>
10-
<version>3.15.5-OS6</version>
10+
<version>3.15.5-OS7</version>
1111
</project>

0 commit comments

Comments
 (0)