`nfc_manager` 需要来自`permission_handler` 的啥许可?
Posted
技术标签:
【中文标题】`nfc_manager` 需要来自`permission_handler` 的啥许可?【英文标题】:what permission from `permission_handler` is needed for `nfc_manager`?`nfc_manager` 需要来自`permission_handler` 的什么许可? 【发布时间】:2021-06-15 07:55:20 【问题描述】:我正在使用下面的插件
nfc_manager: ^3.1.0
permission_handler: ^8.1.0
使用此设置
[✓] Flutter (Channel stable, 2.2.2, on macOS 11.4 20F71 darwin-x64, locale en-EE)
...
[✓] Connected device (3 available)
• Pixel 3a (mobile) • 965AY0WP5C • android-arm64 • Android 11 (API 30)
• macOS (desktop) • macos • darwin-x64 • macOS 11.4 20F71 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.101
• No issues found!
如果我跑
import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';
void main() => runApp(
MaterialApp(
home: Material(
child: ListView.builder(
itemCount: Permission.values.length,
itemBuilder: (context, index)
final p = Permission.values[index];
print(p);
return Center(child: Text('$p'));
,
),
),
),
);
我得到了输出
I/flutter (22369): Permission.camera
I/flutter (22369): Permission.contacts
I/flutter (22369): Permission.location
I/flutter (22369): Permission.locationAlways
I/flutter (22369): Permission.locationWhenInUse
I/flutter (22369): Permission.mediaLibrary
I/flutter (22369): Permission.microphone
I/flutter (22369): Permission.phone
I/flutter (22369): Permission.photos
I/flutter (22369): Permission.photosAddOnly
I/flutter (22369): Permission.reminders
I/flutter (22369): Permission.sensors
I/flutter (22369): Permission.sms
I/flutter (22369): Permission.speech
I/flutter (22369): Permission.storage
I/flutter (22369): Permission.ignoreBatteryOptimizations
I/flutter (22369): Permission.notification
I/flutter (22369): Permission.access_media_location
I/flutter (22369): Permission.activity_recognition
I/flutter (22369): Permission.unknown
I/flutter (22369): Permission.bluetooth
I/flutter (22369): Permission.manageExternalStorage
I/flutter (22369): Permission.systemAlertWindow
⣽I/flutter (22369): Permission.requestInstallPackages
I/flutter (22369): Permission.appTrackingTransparency
I/flutter (22369): Permission.criticalAlerts
I/flutter (22369): Permission.accessNotificationPolicy
我想避免手动添加权限的过程
bu 我不确定我应该向permission_handler
请求哪个权限
访问 NFC
你能帮忙吗?
【问题讨论】:
【参考方案1】:您不需要permission_handler
插件来请求android.permission.NFC
权限,因为这是正常 权限,而不是危险 权限。只需在AndroidManifest.xml
中声明即可,无需权限处理。
【讨论】:
android 部分我不担心,但 ios 部分真的很担心 此处提到了 iOS 设置:pub.dev/packages/nfc_manager#setup。你遵循了吗? 这正是我想要避免的以上是关于`nfc_manager` 需要来自`permission_handler` 的啥许可?的主要内容,如果未能解决你的问题,请参考以下文章