Get a user's choice from prompt for push notifications with Airship and Flutter

37 Views Asked by At

I want to get the choice of the user like (allow/don't allow) for receving push notifications. I use Airship for Flutter version 7.1.2.

However, using the documentation and setting Airship.push.setUserNotificationsEnabled(true); allows the receiving of push notifications even if I click "don't allow". I check it with

Airship.push.isUserNotificationsEnabled.then((status) => { 
     debugPrint("Status: $status"),
)};

Any ideas how to get the user's choice and not the pre-defined value?

1

There are 1 best solutions below

0
Anna R. On

Just found a solution in another documentation

"When setUserNotificationsEnabled enabled, it will cause the user to be prompted for the permission on platforms that support it. To get the result of the prompt, use enableUserNotifications."