简体   繁体   中英

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

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
bu I'm not sure which permission from permission_handler should I request
to access 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. Simply declare it in AndroidManifest.xml , no permission handling is required.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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