Skip to content

Commit

Permalink
Fix Android openNotificationSettings
Browse files Browse the repository at this point in the history
Implemented solution in issue spencerccf#36 for issue spencerccf#34
  • Loading branch information
rahul0101 authored Aug 13, 2020
1 parent 88d6f24 commit 9802283
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.example.appsettings
import android.content.Intent;
import android.provider.Settings;
import android.net.Uri
import android.os.Build

import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
Expand Down Expand Up @@ -63,7 +64,13 @@ class AppSettingsPlugin: MethodCallHandler {
} else if (call.method == "display") {
openSettings(Settings.ACTION_DISPLAY_SETTINGS)
} else if (call.method == "notification") {
openSettings(Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS)
if(Build.VERSION.SDK_INT >= 21) {
val intent = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS)
.putExtra(Settings.EXTRA_APP_PACKAGE, this.registrar.activity().getPackageName())
this.registrar.activity().startActivity(intent);
} else {
openSettings(Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
}
} else if (call.method == "nfc") {
openSettings(Settings.ACTION_NFC_SETTINGS)
} else if (call.method == "sound") {
Expand Down

0 comments on commit 9802283

Please sign in to comment.