Skip to content

Commit c9f048d

Browse files
committed
Use OS check rather than targetSdkVersion
1 parent e105cac commit c9f048d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,9 @@ private static void handleDismissFromActionButtonPress(Context context, Intent i
7575
if (intent.getBooleanExtra("action_button", false)) {
7676
NotificationManagerCompat.from(context).cancel(intent.getIntExtra(BUNDLE_KEY_ANDROID_NOTIFICATION_ID, 0));
7777

78-
//Close notification drawer user override targetSdkVersion to be lower than Android 11
78+
// Only close the notifications shade on Android versions where it is allowed, Android 11 and lower.
7979
// See https://developer.android.com/about/versions/12/behavior-changes-all#close-system-dialogs
80-
int targetSdkVersion = context.getApplicationContext().getApplicationInfo().targetSdkVersion;
81-
if (targetSdkVersion < Build.VERSION_CODES.S ) {
80+
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.S) {
8281
context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
8382
}
8483
}

0 commit comments

Comments
 (0)