简体   繁体   English

Flutter permission_handler 不要求通知

[英]Flutter permission_handler Doesnt ask for notification

I'm using firabase notifications.我正在使用 firabase 通知。 But before initialize it i want to ask user to get permission.但在初始化之前,我想请求用户获得许可。 But when i using permission_handler its not asking to user even i uninstall and reinstall app.但是,当我使用 permission_handler 时,即使我卸载并重新安装应用程序,它也不会询问用户。 How can i solve it?我该如何解决? its my code for ask it:这是我问它的代码:

@override
  void initState() { 
    getPermissions();
}




    void getPermissions() async {
        var requestResult = await Permission.notification.request();
        var isPermissionGranted = await Permission.notification.isGranted;
        var isPermissionPermamentlyDenied =
            await Permission.notification.isPermanentlyDenied;

       //Its giving logs immediatly. Doesn't ask for permission.
        log("requestResult $requestResult");
        log("isPermissionGranted $isPermissionGranted");
        log("isPermissionPermamentlyDenied $isPermissionPermamentlyDenied");

The following permissions will show no dialog:以下权限将不显示对话框:

Notification Bluetooth The following permissions will show no dialog, but will open the corresponding setting intent for the user to change the permission status: Notification Bluetooth 以下权限不会显示对话框,但会打开相应的设置intent供用户更改权限状态:

manageExternalStorage systemAlertWindow requestInstallPackages accessNotificationPolicy link: https://pub.dev/packages/permission_handler manageExternalStorage systemAlertWindow requestInstallPackages accessNotificationPolicy 链接: https://pub.dev/packages/permission_handler

Is your test device iOS or android?您的测试设备是 iOS 还是 android?
If it's iOS, you have to configure in Xcode.如果是 iOS,则必须在 Xcode 中进行配置。 Under Signing & Capabilities .Signing & Capabilities下。 Add Push Notifications.添加推送通知。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM