`nfc_manager` 需要`permission_handler` 的什么许可?
what permission from `permission_handler` is needed for `nfc_manager`?
我正在使用下面的插件
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
你能帮忙吗?
你不需要permission_handler
插件来请求权限android.permission.NFC
因为它是正常权限,而不是危险 允许。只需在AndroidManifest.xml
声明即可,无需权限处理
我正在使用下面的插件
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
你能帮忙吗?
你不需要permission_handler
插件来请求权限android.permission.NFC
因为它是正常权限,而不是危险 允许。只需在AndroidManifest.xml
声明即可,无需权限处理