Vanethos / flutter_notification_permissions

Plugin for Flutter to check and ask for Notification Permissions
BSD 2-Clause "Simplified" License
81 stars 75 forks source link

requestNotificationPermissions returns "unknown" even when it's actually granted #15

Open JmeHsieh opened 5 years ago

JmeHsieh commented 5 years ago

If the permission status is currently unknown, requestNotificationPermissions will return granted if I accept the dialog, which is correct.

But when the status is already granted, requestNotificationPermissions always returns unknown, yet getNotificationPermissionStatus returns granted correctly.

Tested on iOS 12.1, 13.1, 13.2.

Vanethos commented 4 years ago

Hello there!

Sorry for taking so long to reply.

Was this tested only on a simulator or also in physical devices?

JmeHsieh commented 4 years ago

I was testing on physical iPhoneX

Vanethos commented 4 years ago

Does the same happen with v0.4.4?

Zazo032 commented 4 years ago

@Vanethos I have this issue on a Oneplus 5 running Android 9 (didn't test any other version) with this code.

  onPressed: () async {
    PermissionStatus status = await NotificationPermissions.requestNotificationPermissions();
    print('Status: $status');
    final bool granted = status == PermissionStatus.granted;
    print('Granted: $granted');
    return Navigator.maybePop(context, granted);
  },

And this is the output:

I/flutter (15444): Status: PermissionStatus.unknown
I/flutter (15444): Granted: false

In the docs, it says Android will never have an unknown status, but I'm getting it. In app settings, notifications are enabled (fresh install of the app, so it should be enabled by default anyway). Also, if I manually disable them, it also prints unknown as status.

I'm using v0.4.4 and Flutter 1.15.4-pre.117 while debugging.

thearaks commented 4 years ago

@Vanethos I'm having the same behavior with version 0.4.4 on an iPhone device with iOS 13.3.1

When the status is already granted, requestNotificationPermissions always returns unknown, yet getNotificationPermissionStatus returns granted correctly.

thearaks commented 4 years ago

@Vanethos this issue probably needs to be reopened. And probably is a high priority one... If you need help to make a fix let me know!

Zazo032 commented 4 years ago

@thearaks if you know or can work out a fix for this, you can submit a PR for it with the fix, so it can be fixed and published faster

thearaks commented 4 years ago

@Zazo032 I'm not an expert iOS developer and, beside that, I prefer to get in touch with the maintainer before submitting a PR. The last thing I want is to spend time preparing a fix that will never be merged since I'm already pretty busy at the moment :)

Vanethos commented 4 years ago

@thearaks in the following days I’ll be checking this issue, thanks for the heads up!

thearaks commented 3 years ago

@Vanethos hi! Any update on this issue? 😄