颤音:获取当前已启用哪种类型的位置权限

发布于 2025-02-07 16:22:14 字数 542 浏览 2 评论 0原文

嘿,我正在使用权限处理程序软件包,以便请求并获得我的权限的当前状态。 我现在有以下三个权限

[Permission.location, Permission.locationWhenInUse, Permission.locationAlways]

,我想知道当前使用的哪个权限。 由于某种原因,我尝试做这样的事情

    List<PermissionStatus> status = await Future.wait(permissionTypes.map(
      (permission) async => await permission.request(),
    ));

,我收到

[PermissionStatus.granted, PermissionStatus.granted, PermissionStatus.granted]

我的目标是知道是否拒绝了许可,仅拒绝或始终如一。

关于如何实现这一目标有什么想法?

Hey I am using the permission handler package in order to request and get the current status of my permissions.
I have the following three permissions

[Permission.location, Permission.locationWhenInUse, Permission.locationAlways]

Now I want to know which of those is currently the one in use.
I tried doing something like this

    List<PermissionStatus> status = await Future.wait(permissionTypes.map(
      (permission) async => await permission.request(),
    ));

For some reason I receive

[PermissionStatus.granted, PermissionStatus.granted, PermissionStatus.granted]

My goal is to know if the permission is denied, onlyWhenInUse or always.

Any ideas on how to achieve this ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文