From 36b3e25259122fec7ec18cedc40116a149239d6b Mon Sep 17 00:00:00 2001 From: Distopico Vegan Date: Thu, 22 Nov 2018 00:27:32 -0500 Subject: [PATCH] fix: check compatibility on notification settings --- .../java/org/dystopia/email/FragmentSetup.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/dystopia/email/FragmentSetup.java b/app/src/main/java/org/dystopia/email/FragmentSetup.java index 72683715..fe87d290 100644 --- a/app/src/main/java/org/dystopia/email/FragmentSetup.java +++ b/app/src/main/java/org/dystopia/email/FragmentSetup.java @@ -542,10 +542,18 @@ public class FragmentSetup extends FragmentEx { } private static Intent getIntentNotifications(Context context) { - return new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS) - .putExtra("app_package", context.getPackageName()) - .putExtra("app_uid", context.getApplicationInfo().uid) - .putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName()); + Intent intent = new Intent(); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + intent = new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS); + intent.putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName()); + } else { + intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS"); + } + intent.putExtra("app_package", context.getPackageName()) + .putExtra("app_uid", context.getApplicationInfo().uid); + + return intent; } private void handleExport(Intent data) {