This repo contains a collection of permission related Flutter plugins which can be used to request permissions to access device resources in a cross-platform way.

Overview

Flutter Permission Plugins


Deprecation Notice

This repository has been replaced by the Flutter permission_handler plugin and will not longer be maintained. Starting from 10/05/2021 this repository will be marked read-only.


This repo contains a collection of permission related Flutter plugins which can be used to request permissions to access device resources in a cross-platform way.

Plugins

Currently we support the following plugins:

Plugin Pub
location_permissions pub package
Comments
  • Add permissions levels on Android

    Add permissions levels on Android

    πŸš€ Feature Requests

    Add permissions levels support for the Android platform

    Contextualize the feature

    The LocationPermissions().checkPermissionStatus(level: LocationPermissionLevel.locationWhileInUse) is always returning PermissionStatus.denied on Android 10 and doesn't respect granted permissions.

    screenshot_20191020-191001

    Describe the feature

    Utilize LocationPermissionLevel enum on the Android platform

    Platforms affected (mark all that apply)

    • [ ] :iphone: iOS
    • [x] :robot: Android
    good first issue platform: android status: in progress type: enhancement 
    opened by formatCvt 21
  • Migrate to null safety

    Migrate to null safety

    This updates the dart SDK dependency to require a null safe dart version and also migrated the source code to be null safe. Also, set the version number to 4.0.0 because after this change the package is not compatible with non-null safe Flutter anymore.

    This resolves #54

    • [x] All projects build
    • [x] Follows style guide lines (code style guide)
    • [x] Relevant documentation was updated
    • [x] Rebased onto current develop
    opened by wwwdata 14
  • CheckPermissionStatus returns denied after granted was returned when requesting permissions

    CheckPermissionStatus returns denied after granted was returned when requesting permissions

    PermissionStatus geolocationPermissionStatus = await _locationPermissions.requestPermissions(permissionLevel: LocationPermissionLevel.locationWhenInUse);
    

    returns PermissionStatus.granted

    but after that

    final PermissionStatus geolocationPermissionStatus = await _locationPermissions.checkPermissionStatus(level: LocationPermissionLevel.locationWhenInUse);
    

    returns PermissionStatus.denied

    On my manifest I have only this

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    

    Originally posted by @DenisBogatirov in https://github.com/Baseflow/flutter-permission-plugins/issues/21#issuecomment-582366361

    platform: android 
    opened by mvanbeusekom 12
  • iOS - Location permission dialog is not appearing and always giving denied response.

    iOS - Location permission dialog is not appearing and always giving denied response.

      final PermissionStatus permissionRequestResult = await LocationPermissions()
            .requestPermissions();
        if(permissionRequestResult == PermissionStatus.granted){
          onGranted();
        }else{
          onDenied();
        }
    

    always executing onDenied() function

    Version: 2.0.5

    Platform:

    • [x] :iphone: iOS
    • [ ] :robot: Android
    platform: ios status: triage 
    opened by ravitejaavv 9
  • On Android version less than 6 (M) checkPermissionStatus returns Denied

    On Android version less than 6 (M) checkPermissionStatus returns Denied

    πŸ› Bug Report

    Method checkPermissionStatus on Android without runtime permissions (pre M) always Denied but actually it should be Granted as permissions are given during installation.

    Version: 4.0.0

    Platform: [5.0.2] :robot: Android

    platform: android type: bug 
    opened by orteney 4
  • [location][ios] whenInUse returns denied

    [location][ios] whenInUse returns denied

    πŸ› Bug Report

    When requesting location permission on iOS, the user selects "only when in use." The plugin returns "denied."

    Expected behavior

    "Granted," or maybe "restricted." (Have I misunderstood the semantics here? If it's a matter of what the default PermissionLevel.location means on Android vs iOS, please document the difference!)

    Reproduction steps

    From a Flutter iOS app, call requestPermissions(). Choose "When in use" from the prompt. See "denied" logged as the return value.

    https://github.com/BaseflowIT/flutter-permission-plugins/blob/develop/packages/location_permissions/ios/Classes/LocationPermissionsPlugin.m#L195

    https://github.com/BaseflowIT/flutter-permission-plugins/blob/develop/packages/location_permissions/ios/Classes/LocationPermissionsPlugin.m#L108

    Configuration

    Version: 2.0.2

    Platform:

    • [x] :iphone: iOS
    • [ ] :robot: Android
    opened by mockturtl 4
  • requestPermissions fails after checkPermissionStatus is called on iOS

    requestPermissions fails after checkPermissionStatus is called on iOS

    πŸ› Bug Report

    If requestPermissions is called, this exception is thrown:

    [VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: PlatformException(ERROR_ALREADY_REQUESTING_PERMISSION, A request for permissions is already running, please wait for it to finish before doing another request., null)
    #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:564)
    #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:302)
    <asynchronous suspension>
    #2      LocationPermissions.requestPermissions (package:location_permissions/src/location_permissions.dart:70)
    <asynchronous suspension>
    #3      LocationRequest._requestPerms (package:social_dating/location_request.dart:15)
    <asynchronous suspension>
    #4      LocationRequest.build.<anonymous closure> (package:social_dating/location_request.dart:51)
    #5      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:511)
    #6      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:566)
    #7      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:166)
    #8      TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:240)
    #9      TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:177)
    #10     PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:436)
    #11     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73)
    #12     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101)
    #13     _RenderingFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:221)
    #14     _RenderingFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:199)
    #15     _RenderingFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156)
    #16     _RenderingFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102)
    #17     _RenderingFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86)
    #18     _rootRunUnary (dart:async/zone.dart:1136)
    #19     _CustomZone.runUnary (dart:async/zone.dart:1029)
    #20     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931)
    #21     _invoke1 (dart:ui/hooks.dart:233)
    #22     _dispatchPointerDataPacket (dart:ui/hooks.dart:154)
    

    Expected behavior

    This should work with no exception.

    Reproduction steps

    • First call await checkPermissionStatus
    • Then call await requestPermissions

    Version: 2.0.0

    Platform:

    • [x] :iphone: iOS
    • [ ] :robot: Android
    opened by rhlgs 4
  • Execution failed for task ':app:transformClassesWithMultidexlistForDebug'

    Execution failed for task ':app:transformClassesWithMultidexlistForDebug'

    πŸ› Bug Report

    Launching lib/main.dart on Android SDK built for x86 in debug mode... Initializing gradle... Resolving dependencies... Running Gradle task 'assembleDebug'... D8: Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

    FAILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

    com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes. Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

    • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    • Get more help at https://help.gradle.org

    BUILD FAILED in 10s


    The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app. See https://goo.gl/CP92wY for more information on the problem and how to fix it.


    Finished with error: Gradle task assembleDebug failed with exit code 1

    Expected behavior

    Reproduction steps

    after adding location_permissions library I receive an error in the android build process

    Configuration

    environment: sdk: ">=2.1.0 <3.0.0"

    dependencies: flutter: sdk: flutter

    cupertino_icons: ^0.1.2 numberpicker: ^1.0.0 google_maps_flutter: ^0.5.5 location_permissions: ^1.0.2

    dev_dependencies: flutter_test: sdk: flutter

    Version: 1.x

    Platform:

    • [ ] :iphone: iOS
    • [X] :robot: Android
    opened by j3g 4
  • Location permission level has no effect on checking or requesting permissions.

    Location permission level has no effect on checking or requesting permissions.

    πŸ› Bug Report

    This bug has two wrong behaviors:

    First: When checking for location permission status using the permission level parameter, the results are always the same independently of the permission level passed as parameter.

    Second: If your project requires permission for always, the systems return denied for all permission levels if you have not granted the always permission. It doesn't differentiate the WhenInUse for the WhenInUse level.

    It seems that it is missing the capability to return the propper permission status when "While In Use" is granted. Even if the query (check) is using the LocationPermissionLevel.locationWhenInUse is used in the method call.

    Expected behavior

    I understand that the correct behavior would be to return the proper permission granted for permission level checked.

    Reproduction steps

    You can use the sample application to reproduce the error. I'm running the tests in a Nexus 4 API 29 emulator.

    Check the sequences below to reproduce the error:

    Screen Shot 2020-05-24 at 11 51 15 AM Screen Shot 2020-05-24 at 11 51 12 AM Screen Shot 2020-05-24 at 11 51 08 AM

    Configuration

    My AndroidManifest.xml has the following lines:

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
    

    My build.gradle is set for:

    compileSdkVersion 29
    ...
    targetSdkVersion 29
    

    Version: 2.0.5

    Platform:

    • [ ] :iphone: iOS
    • [x] :robot: Android
    opened by mlemos 3
  • Issue 21

    Issue 21

    :sparkles: What kind of change does this PR introduce? (Bugfix, feature, docs update...)

    New feature

    :arrow_heading_down: What is the current behavior?

    The current behavior of the plugin automatically returns Permission.denied and doesn't respect granted permissions.

    :new: What is the new behavior (if this is a feature change)?

    WhileInUse feature

    :boom: Does this PR introduce a breaking change?

    :bug: Recommendations for testing

    Code review

    :memo: Links to relevant issues/docs

    https://github.com/Baseflow/flutter-permission-plugins/issues/21

    :thinking: Checklist before submitting

    • [x] All projects build
    • [x] Follows style guide lines (code style guide)
    • [ ] Relevant documentation was updated
    • [x] Rebased onto current develop
    platform: android type: enhancement 
    opened by StijnWoerkom 3
  • Android 10 background location

    Android 10 background location

    This is a relatively minor PR that adds support for the new background location permission in Android 10.

    • [X ] All projects build
    • [X] Follows style guide lines (code style guide)
    • [X] Relevant documentation was updated
    • [X] Rebased onto current develop
    opened by josh-burton 3
  • LocationPermissionsPlugin.java uses or overrides a deprecated API

    LocationPermissionsPlugin.java uses or overrides a deprecated API

    πŸ› Bug Report

    Note: . . .location_permissions-4.0.0/android/src/main/java/com/baseflow/location_permissions/LocationPermissionsPlugin.java uses or overrides a deprecated API.

    Note: Recompile with -Xlint:deprecation for details.


    Thanks for looking into this.

    opened by farr64 0
  • conver serviceStatus of single stream to multi stream

    conver serviceStatus of single stream to multi stream

    Hi, I'm new contributing. I ran into a problem when I was listening to the status of the gps "serviceStatus" in multiple pages of my app, so I decided to make the "serviceStatus" be able to broadcast to multiple listeners

    I consider that it is a minor change, it should not affect the operation of "serviceStatus"

    opened by skapxd 0
  • Will these packages eventually replace the permission_handler package?

    Will these packages eventually replace the permission_handler package?

    I remember reading in one of the issues that Baseflow wanted to make every single permission in to their seperate packages like this package. Is this strategy still valid? I see there is not much activity in this repo and just wanted to be sure.

    We need this package at least for the locationServicesEnabled Stream which is not found in any other plugin. Thanks for that since it is very useful.

    However, we need to use many packages for very similar things. Geolocator, Permission_handler, location_permission and it is hard to manage and read our own code after a while.

    So I will be very glad if you could share some of your plans for the future. Thanks

    Bonus question: What might be the reason I get PermissionStatus.denied from LocationPermissions().requestPermissions() without iOS showing the location request dialog?

    opened by aytunch 1
  • [android]

    [android] "Can request only one set of permissions at a time."

    πŸ› Bug Report

    Calling await LocationPermissions().requestPermissions(); with both "Fine" and "Coarse" permission in AndroidManifest.xml gives the Can request only one set of permissions at a time. in the logs. Also, giving PermissionStatus.denied (even if approved) when checkPermissions called after awaiting requestPermissions.

    Expected behaviour

    The error/warning should not come in and correct status should be returned by checkPermissions after requestPermissions is called.

    Reproduction steps

    Code to reproduce:

    
      Future<bool> _checkLocationPermission() async {
        final checkPermission = await LocationPermissions().checkPermissionStatus();
        printIfDebug("checkPermission: $checkPermission");
        if (checkPermission == PermissionStatus.granted ||
            checkPermission == PermissionStatus.restricted) return true;
        return false;
      }
    
      Future<bool> _checkAndRequestLocationPermission() async {
        // return true, if already have permission
        if (await _checkLocationPermission()) return true;
    
        // request permission
        final _ = await LocationPermissions().requestPermissions();
        printIfDebug("requestPermission: $_");
    
        // check if permission was given
        final hasPermission = await _checkLocationPermission();
    
        // if no permission and "showShowPermissionRationale" then go to settings and return false
        if (!hasPermission &&
            await LocationPermissions().shouldShowRequestPermissionRationale()) {
          // if shouldRequest false, then open app settings and return false
          // TODO UI that shows why this permission is required
          await LocationPermissions().openAppSettings();
          return false;
        }
    
        return hasPermission;
      }
    

    This is how it it is used for checking access for location before calling WifiManager.startScan api on android

      Future<List<WifiNetwork>> scanWifi() async {
        if (await _checkAndRequestLocationPermission())
          return await WiFiForIoTPlugin.loadWifiList();
        return null;
      }
    

    Configuration

    Android SDK: 28

    Version: ^3.0.0

    Platform:

    • [ ] :iphone: iOS
    • [x] :robot: Android
    opened by daadu 5
  • iOS permission key search is incomplete

    iOS permission key search is incomplete

    πŸ› Bug Report

    Using XCode 12.1 & iOS 14.1, there is an additional location permission key which is ignored by this plugin. The key in question is 'NSLocationAlwaysAndWhenInUseUsageDescription' which is an amalgamation of the handled keys 'NSLocationWhenInUseUsageDescription' and 'NSLocationAlwaysUsageDescription'. The current code does not have a check for this "new" key. Although I am a novice wrt to Flutter plugins, I will try to create a pull request.

    Expected behavior

    To not throw an exception when the key 'NSLocationAlwaysAndWhenInUseUsageDescription' is used in the Info.plist.

    Reproduction steps

    Define 'NSLocationAlwaysAndWhenInUseUsageDescription' in Info.plist. Debugging the app demonstrates that an exception is thrown -

    Exception has occurred.
    PlatformException (PlatformException(ERROR_MISSING_PROPERTYKEY, To use location in iOS8 you need to define either NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription in the app bundle's Info.plist file, null, null))
    

    Configuration

    Version: 1.x

    Platform:

    • [X] :iphone: iOS
    • [ ] :robot: Android
    opened by bhusang 1
Owner
Baseflow
We provide software, skills and knowledge and with this we want to make a contribution to the world. We love to make innovation happen.
Baseflow
Unloc customizations of the Permission plugin for Flutter. This plugin provides an API to request and check permissions.

Flutter Permission handler Plugin A permissions plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check perm

Unloc 1 Nov 26, 2020
A sample app of using the image_picker + path_provider and permission_handler package to request permission and store photos on mobile

image_picker_example A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you sta

iang12 4 Apr 19, 2022
MedRec: Using Blockchain for Medical Data Access and Permission Management

MedRec Medical records need innovation. Patients leave data scattered across various jurisdictions as life events take them away from one provider’s d

Abhishek Kumar 4 Sep 14, 2022
Deepak Sharma 149 Dec 10, 2022
Starter project for Flutter plugins willing to access native and synchronous rust code using FFI

Flutter Rust FFI Template This project is a Flutter Plugin template. It provides out-of-the box support for cross-compiling native Rust code for all a

JΓΈrβˆ‚Β‘ 561 Dec 7, 2022
An Application built for students to access Notes , Question Papers , Syllabus and Resources for all Subjects of O.U (Osmania University) using Flutter πŸ“˜πŸ‘¨β€πŸŽ“

OU Notes [Osmania University (O.U)] . For the Students , By the Students. An Application for Osmania University students to access educational materia

Abdul Malik 212 Nov 20, 2022
A Flutter plugin to request the device unlock screen.

device_unlock A Flutter plugin to request the device unlock screen on Android and iOS. How does it work The following attempts and fallbacks are made:

CΓ­ngulo 19 Sep 7, 2022
Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

Vehement 8 Nov 26, 2022
A collection of Flutter plugins developed by CACHET

CACHET Flutter plugins This repo contains the source code for Flutter first-party plugins developed by developers at the Copenhagen Center for Health

Copenhagen Center for Health Technology (CACHET) 400 Jan 7, 2023
A Flutter plugin for iOS and Android allowing access to the device cameras.

Camera Plugin A Flutter plugin for iOS and Android allowing access to the device cameras. Note: This plugin is still under development, and some APIs

Rebar Ahmad 1 Mar 17, 2020
A Flutter plugin for Android and iOS allowing access to the device cameras, a bit deeper!!

flutter_cameraview A Flutter plugin for Android and iOS allowing access to the device cameras, a bit deeper!!. This plugin was created to offer more a

Herizo Ramaroson 18 Oct 22, 2022
System info plus - A Flutter plugin to get device Random Access Memory (RAM) size

system_info_plus A Flutter plugin to get device Random Access Memory (RAM) size.

Sebghatullah Yusuf 2 Aug 21, 2022
A Flutter plugin for iOS and Android allowing access to the device cameras.

A Flutter plugin for iOS and Android allowing access to the device cameras.

Lightsnap 140 Jan 8, 2023
The repo contains the source code for all the tutorials on the FilledStacks Youtube channel.

Flutter tutorials The repo contains the source code for all the written tutorials by Filledstacks. All Tutorials plus additional snippets and shorter

Dane Mackier 4.5k Dec 31, 2022
A Flutter repo with a ready-to-go architecture containing flavors, bloc, device settings, json serialization and connectivity

Flutter Ready to Go A Flutter repo with a ready-to-go architecture containing flavors, bloc, device settings, json serialization and connectivity. Why

null 139 Nov 11, 2022
Youtube API in Dart app. Used for downloading media and search request.

Youtube API Youtube API made by using Dart and Flutter in a cross-platform app. Used for downloading media and search request. For an idea of how the

Avian Silviu-Gabriel 0 Nov 4, 2021
SSH no ports provides ssh to a remote Linux device with out that device having any ports open

Ssh! No ports ssh no ports provides a way to ssh to a remote linux host/device without that device having any open ports (not even 22) on external int

The Atsign Foundation 224 Dec 21, 2022
Morphing Coffee 0 Jan 27, 2022
Rajagiri connect is a networking platform that enables the students of Rajagiri to form a social network among themselves, enabling them to connect with their seniors, juniors and faculty for sharing of information and resources.

Rajagiri Connect Rajagiri connect is a networking platform that enables the students of Rajagiri to form a social network among themselves, enabling t

Muhammad Amaan 2 Nov 27, 2022