简体   繁体   English

`nfc_manager` 需要来自`permission_handler` 的什么许可?

[英]what permission from `permission_handler` is needed for `nfc_manager`?

I'm using the plugins below我正在使用下面的插件

  nfc_manager: ^3.1.0
  permission_handler: ^8.1.0

with this setup有了这个设置

[✓] 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!

if I run如果我跑

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 get the output我得到 output

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

I'd like to avoid to go through the process of manually adding the permissions我想通过手动添加权限的过程来避免 go
bu I'm not sure which permission from permission_handler should I request bu 我不确定我应该向permission_handler请求哪个权限
to access NFC访问 NFC

can you help?你能帮我吗?

You don't need permission_handler plugin to request permission android.permission.NFC because it's normal permission, not dangerous permission.您不需要permission_handler插件来请求权限android.permission.NFC因为这是正常权限,而不是危险权限。 Simply declare it in AndroidManifest.xml , no permission handling is required.只需在AndroidManifest.xml中声明即可,无需权限处理。

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

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