Coder Social home page Coder Social logo

baseflow / flutter-permission-handler Goto Github PK

View Code? Open in Web Editor NEW
2.0K 33.0 799.0 7.29 MB

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

Home Page: https://baseflow.com

License: MIT License

Ruby 1.86% Dart 84.89% Shell 0.38% CMake 4.56% C++ 7.87% HTML 0.45%
flutter flutter-plugin permission ios android dart baseflow

flutter-permission-handler's Introduction

Flutter permission_handler plugin

The Flutter permission_handler plugin is build following the federated plugin architecture. A detailed explanation of the federated plugin concept can be found in the Flutter documentation. This means the permission_handler plugin is separated into the following packages:

  1. permission_handler: the app facing package. This is the package users depend on to use the plugin in their project. For details on how to use the permission_handler plugin you can refer to its README.md file. At this moment the Android and iOS platform implementations are also part of this package. Additional platform support will be added in their own individual "platform package(s)".
  2. permission_handler_platform_interface: this packages declares the interface which all platform packages must implement to support the app-facing package. Instructions on how to implement a platform packages can be found in the README.md of the permission_handler_platform_interface package.

flutter-permission-handler's People

Contributors

alex-sandri avatar azack avatar azchohfi avatar christianedwardpadilla avatar danielroek avatar dius00 avatar ened avatar florissmit1 avatar jddv avatar jeroenweener avatar long1eu avatar lukaskurz avatar manoylok avatar marcelgarus avatar martijn00 avatar michaelnabil230 avatar mkwsra avatar mono0926 avatar mvanbeusekom avatar nealsoni00 avatar nwatab avatar renefloor avatar rmdymathias avatar spitfire55 avatar timhoogstrate avatar tong-huang avatar ty0x2333 avatar vbuberen avatar wujek-srujek avatar yannickmaljaars avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter-permission-handler's Issues

Undefined class 'PermissionStatus'.

๐Ÿ› Bug Report

Cannot compile and run from main (Is this even supposed to be run?)
Dart Analysis error: Undefined class 'PermissionStatus'. (undefined_class at [permission_handler] lib/utils/codec.dart:5)

Expected behavior

No errror

Reproduction steps

Configuration

Version: 2.0.0

Platform:

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

2.1.1 swift compilation error

My project doesn't compile anymore because of this:

/Users/jaumard/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/PermissionManager.swift:50:108: error: cannot convert value of type '[UIApplication.OpenExternalURLOptionsKey : Any]' (aka 'Dictionary<NSString, Any>') to expected argument type '[String : Any]'
                    UIApplication.shared.open(URL.init(string: UIApplication.openSettingsURLString)!, options: convertToUIApplicationOpenExternalURLOptionsKeyDictionary([:]),
                                                                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                                                                                                              as [String : Any]
    /Users/jaumard/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/PermissionManager.swift:55:91: error: 'openSettingsURLString' has been renamed to 'UIApplicationOpenSettingsURLString'
                    let success = UIApplication.shared.openURL(URL.init(string: UIApplication.openSettingsURLString)!)
                                                                                              ^~~~~~~~~~~~~~~~~~~~~
                                                                                              UIApplicationOpenSettingsURLString
    UIKit.UIApplication:64:22: note: 'openSettingsURLString' was introduced in Swift 4.2
        public class let openSettingsURLString: String
                         ^
    /Users/jaumard/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/PermissionManager.swift:95:54: error: closure tuple parameter '(key: String, value: Any)' does not support destructuring
            return Dictionary(uniqueKeysWithValues: input.map { key, value in (UIApplication.OpenExternalURLOptionsKey(rawValue: key), value)})
                                                                ^~~~~~~~~~
                                                                (arg) -> <#Result#> let (key, value) = arg; return 

Do I need to update something on iOS side ?

Version: 2.1.1

Platform:
iOS

execution stops on requesting permission

๐Ÿ› Bug Report

Map<PermissionGroup, PermissionStatus> permissions = await PermissionHandler().requestPermissions([PermissionGroup.calendar]);

Device shows permission request, whatever user selects accept or decline the execution stops at that string. It doesn't stop if permission already granted.

Calendar permission defined in manifest.

plugin version v.2.1.0
[โˆš] Flutter (Channel beta, v0.9.4, on Microsoft Windows [Version 10.0.17134.345], locale en-US)
[โˆš] Android toolchain - develop for Android devices (Android SDK 28.0.2)
[โˆš] Android Studio (version 3.2)
[โˆš] Connected devices (1 available)

On performing Hot Reload - Console shows:

E/flutter ( 2113): PlatformException(ERROR_ALREADY_REQUESTING_PERMISSIONS, A request for permissions is already running, please wait for it to finish before doing another request (note that you can request multiple permissions at the same time)., null)

Unresolved reference: ActivityCompat

I jsut added it to my project and getting the following error hen trying to compile:
image

ย 
Unresolved reference: ActivityCompat
Unresolved reference: content
Unresolved reference: ContextCompat
Unresolved reference: ActivityCompat
Unresolved reference: ActivityCompat 87 actionable tasks: 5 executed, 82 up-to-date

Any clue about what could possibly going wrong?
Obs.: my project was completely migrated to androidx packages.

Kotlin version doesn't compile

๐Ÿ› Bug Report

* What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.2.51 and higher. Project 'permission_handler' is using version 1.2.30.

Same problem for geolocator and google_api_availability... :(

Expected behavior

Reproduction steps

Basic usage with last Android Studio and gradle 3.2.0

Version: last

Platform:

  • ๐Ÿ“ฑ iOS
  • [*] ๐Ÿค– Android

Requesting permission for microphone but getting response for speech on Android

๐Ÿ› Bug Report

I'm requesting permission for PermissionGroup.microphone but in the results the permission is PermissionGroup.speech. This is confusing and very unintuitive behavior.

Expected behavior

The permission group names in the results match the permission group names in the request.

Reproduction steps

PermissionHandler().requestPermissions([
  PermissionGroup.microphone,
]).then((permissions) {
  print(permissions[PermissionGroup.microphone]); // this is null
  print(permissions[PermissionGroup.speech]); // this is the actual permission
});

Configuration

Version: 2.1.2

Platform:

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android
โฏ flutter doctor -v
[โœ“] Flutter (Channel beta, v1.0.0, on Linux, locale en_US.UTF-8)
    โ€ข Flutter version 1.0.0 at /home/antti/tools/flutter
    โ€ข Framework revision 5391447fae (10 weeks ago), 2018-11-29 19:41:26 -0800
    โ€ข Engine revision 7375a0f414
    โ€ข Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[โœ“] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    โ€ข Android SDK at /home/antti/Android/Sdk
    โ€ข Android NDK location not configured (optional; useful for native profiling support)
    โ€ข Platform android-28, build-tools 28.0.3
    โ€ข Java binary at: /usr/bin/java
    โ€ข Java version OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
    โ€ข All Android licenses accepted.

[!] Android Studio (not installed)
    โ€ข Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.io/setup/#android-setup for detailed instructions).

[โœ“] VS Code (version 1.30.2)
    โ€ข VS Code at /usr/share/code
    โ€ข Flutter extension version 2.22.3

[โœ“] Connected device (1 available)
    โ€ข F5321 โ€ข BH9035L55P โ€ข android-arm64 โ€ข Android 8.0.0 (API 26)

1.0.1 & 2.0.0 version

๐Ÿ› Bug Report

=== BUILD TARGET url_launcher OF PROJECT Pods WITH CONFIGURATION Debug ===
/Users/xxx/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.0.0/ios/Classes/PermissionHandlerPlugin.m:2:9: fatal error: 'permission_handler/permission_handler-Swift.h' file not found
#import <permission_handler/permission_handler-Swift.h>

Expected behavior

Reproduction steps

Configuration

Cocoapods 1.5.3

Podfile
...
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['SWIFT_VERSION'] = '4.1'
end
end
end
...

Version: 1.0.1 & 2.0.0

Platform:

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

resource android:attr/fontVariationSettings not found

๐Ÿ› Bug Report

i can't build my release apk. flutter run on device/emulator work fine. but when i flutter build apk --release there is error like this. i try set compilesdkversion to 28 still doesn't work. thank you

`FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':permission_handler:verifyReleaseResources'.

java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
*****\build\permission_handler\intermediates\res\merged\release\values\values.xml:133: error: resource android:attr/fontVariationSettings not found.
*****\build\permission_handler\intermediates\res\merged\release\values\values.xml:134: error: resource android:attr/ttcIndex not found.
error: failed linking references.

  • 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`

Expected behavior

my previous build and release working fine,

Reproduction steps

[โˆš] Flutter (Channel beta, v1.3.8, on Microsoft Windows [Version 10.0.17134.706], locale en-US)
โ€ข Flutter version 1.3.8 at C:\src\flutter
โ€ข Framework revision e5b1ed7a7f (5 weeks ago), 2019-03-06 14:23:37 -0800
โ€ข Engine revision f4951df193
โ€ข Dart version 2.2.1 (build 2.2.1-dev.0.0 571ea80e11)

[โˆš] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
โ€ข Android SDK at C:\Users\diaz\AppData\Local\Android\Sdk
โ€ข Android NDK location not configured (optional; useful for native profiling support)
โ€ข Platform android-28, build-tools 28.0.3
โ€ข ANDROID_HOME = C:\Users\diaz\AppData\Local\Android\Sdk
โ€ข Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
โ€ข Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
โ€ข All Android licenses accepted.

[โˆš] Android Studio (version 3.3)
โ€ข Android Studio at C:\Program Files\Android\Android Studio
โ€ข Flutter plugin version 34.0.1
โ€ข Dart plugin version 182.5215
โ€ข Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[โˆš] VS Code, 64-bit edition (version 1.33.0)
โ€ข VS Code at C:\Program Files\Microsoft VS Code
โ€ข Flutter extension version 2.25.0

[โˆš] Connected device (1 available)
โ€ข Android SDK built for x86 64 โ€ข emulator-5554 โ€ข android-x64 โ€ข Android 5.1.1 (API 22) (emulator)

โ€ข No issues found!

Configuration

Version: 1.x

Platform:

  • ๐Ÿ“ฑ iOS
  • [*] ๐Ÿค– Android

Android permission status should be unknown if permission hasn't been asked before

๐Ÿ— Enhancement Proposal

Right now, when you check the permission status using

PermissionHandler().checkPermissionStatus(...)

the status returned is always PermissionStatus.denied no matter if you had already asked for permission and user denied it before or this is the first time you are asking for the permission.

Correct behavior would be if you had asked for the permission before, user denied it and you are checking permission status using above code, the status should be PermissionStatus.denied (which is working as expected) BUT if we have not asked for the permission before, the status returned should be PermissionStatus.unknown.

Platforms affected

Android

Version

2.2.0

requestPermission does not return result

๐Ÿ”™ Regression

List permissions_group = [PermissionGroup.contacts, PermissionGroup.storage];

Map<PermissionGroup, PermissionStatus> permissions =
await PermissionHandler().requestPermissions(permissions_group);

print(permissions)

Hi, I tried to run the code above. Unfortunately, I cannot get the result after granting the permission from the dialog. Any suggestion?

False negative returned from by openAppSettings method on iOS

๐Ÿ› Bug Report

Calling the bool isOpened = await PermissionHandler().openAppSettings(); method on iOS opens the settings page but returns false.

Expected behavior

When the setting page is opened the expected result for this method should be true.

Reproduction steps

Start the example App on iOS and hit the "Open Settings Page" icon (right top of the screen). Catch the boolean to see it returns false.

Configuration

Version: 2.1.2

Platform:

  • ๐Ÿ“ฑ iOS

hi,i meet a problem when building a ios project

this is xcode message box tip:
The target โ€œpermission_handlerโ€ contains source code developed with Swift 2.x. Xcode 9 does not support building or migrating Swift 2.x targets.

Use Xcode 8.x to migrate the code to Swift 3.

there is also other plugin writed by swift,such as fluwx. but only permission_handler show that error.
hao should i do?
thanks!

Strange Behavior on Flutter 0.7.3

๐Ÿ› Bug Report

[VERBOSE-2:shell.cc(181)] Dart Error: Unhandled exception:
PlatformException(ERROR_ALREADY_REQUESTING_PERMISSIONS, A request for permissions is already running, please wait for it to finish before doing another request (note that you can request multiple permissions at the same time)., null)

Expected behavior

Reproduction steps

List<PermissionGroup> permissionGroup = [
  PermissionGroup.location,
  PermissionGroup.camera,
  // PermissionGroup.storage,
];
if (Theme.of(context).platform == TargetPlatform.android)
  permissionGroup.add(PermissionGroup.storage);

List<String> ungranted = [];
Map<PermissionGroup, PermissionStatus> permissionList =
    await permissionHandler.requestPermissions(permissionGroup);
permissionList.forEach((a, b) {
  if (b != PermissionStatus.granted) {
    if (a != PermissionGroup.locationAlways &&
        a != PermissionGroup.locationWhenInUse)
      ungranted.add(
          a.toString().replaceAll('PermissionGroup.', '- ').toUpperCase());
  }
});

return ungranted;

Configuration

Version: 2.0.0

Platform:

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

Changelog

๐Ÿ— Enhancement Proposal

Please update the pub changelog.

Pitch

There is a new major version 3.0.0, which improves compatibility and performance & it should be documented in the changelog.

Thank you.

Apple rejects all binaries built using this package, unless ALL permissions have purposes/reasons added in the .plist, even if the app is not using most of them...

Apple now rejects all apps, the error is as follows:

Missing Purpose String in Info.plist File - Your app's code references one or more APIs that access sensitive user data. The app's Info.plist file should contain a NSContactsUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting Spring 2019, all apps submitted to the App Store that access user data will be required to include a purpose string.If you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK and request they release a version of their code that doesn't contain the APIs. Learn more (https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).

Missing Purpose String in Info.plist File - Your app's code references one or more APIs that access sensitive user data. The app's Info.plist file should contain a NSCalendarsUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting Spring 2019, all apps submitted to the App Store that access user data will be required to include a purpose string.If you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK and request they release a version of their code that doesn't contain the APIs. Learn more (https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).

Missing Purpose String in Info.plist File - Your app's code references one or more APIs that access sensitive user data. The app's Info.plist file should contain a NSAppleMusicUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting Spring 2019, all apps submitted to the App Store that access user data will be required to include a purpose string.If you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK and request they release a version of their code that doesn't contain the APIs. Learn more (https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).

Missing Purpose String in Info.plist File - Your app's code references one or more APIs that access sensitive user data. The app's Info.plist file should contain a NSMotionUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting Spring 2019, all apps submitted to the App Store that access user data will be required to include a purpose string.If you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK and request they release a version of their code that doesn't contain the APIs. Learn more (https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).

Missing Purpose String in Info.plist File - Your app's code references one or more APIs that access sensitive user data. The app's Info.plist file should contain a NSSpeechRecognitionUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting Spring 2019, all apps submitted to the App Store that access user data will be required to include a purpose string.If you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK and request they release a version of their code that doesn't contain the APIs. Learn more (https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).

Android app crashes after permission request popup

๐Ÿ› Bug Report

Android app crashes first time request permission when launching, on both deny and grant action . The app restarts, it works fine then.

Map<PermissionGroup, PermissionStatus> permissions = await PermissionHandler().requestPermissions([PermissionGroup.location]);

D/AndroidRuntime( 8448): Shutting down VM
E/AndroidRuntime( 8448): FATAL EXCEPTION: main
E/AndroidRuntime( 8448): Process: com.berkey.berkey, PID: 8448
E/AndroidRuntime( 8448): java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=25, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {com.berkey.berkey/com.berkey.berkey.MainActivity}: java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime( 8448): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4268)
E/AndroidRuntime( 8448): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:4312)
E/AndroidRuntime( 8448): 	at android.app.ActivityThread.-wrap19(Unknown Source:0)
E/AndroidRuntime( 8448): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1644)
E/AndroidRuntime( 8448): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 8448): 	at android.os.Looper.loop(Looper.java:164)
E/AndroidRuntime( 8448): 	at android.app.ActivityThread.main(ActivityThread.java:6494)
E/AndroidRuntime( 8448): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 8448): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
E/AndroidRuntime( 8448): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
E/AndroidRuntime( 8448): Caused by: java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime( 8448): 	at io.flutter.view.FlutterNativeView$1.reply(FlutterNativeView.java:174)
E/AndroidRuntime( 8448): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:203)
E/AndroidRuntime( 8448): 	at com.baseflow.permissionhandler.PermissionHandlerPlugin.processResult(PermissionHandlerPlugin.kt:316)
E/AndroidRuntime( 8448): 	at com.baseflow.permissionhandler.PermissionHandlerPlugin.handlePermissionsRequest(PermissionHandlerPlugin.kt:308)
E/AndroidRuntime( 8448): 	at com.baseflow.permissionhandler.PermissionHandlerPlugin.access$handlePermissionsRequest(PermissionHandlerPlugin.kt:28)
E/AndroidRuntime( 8448): 	at com.baseflow.permissionhandler.PermissionHandlerPlugin$Companion$registerWith$1.onRequestPermissionsResult(PermissionHandlerPlugin.kt:46)
E/AndroidRuntime( 8448): 	at io.flutter.app.FlutterPluginRegistry.onRequestPermissionsResult(FlutterPluginRegistry.java:191)
E/AndroidRuntime( 8448): 	at io.flutter.app.FlutterActivityDelegate.onRequestPermissionsResult(FlutterActivityDelegate.java:125)
E/AndroidRuntime( 8448): 	at io.flutter.app.FlutterActivity.onRequestPermissionsResult(FlutterActivity.java:133)
E/AndroidRuntime( 8448): 	at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:7429)
E/AndroidRuntime( 8448): 	at android.app.Activity.dispatchActivityResult(Activity.java:7280)
E/AndroidRuntime( 8448): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4264)
E/AndroidRuntime( 8448): 	... 9 more
Lost connection to device.

Version: 2.2.0

Platform:

  • ๐Ÿ“ฑ iOS
  • [x ] ๐Ÿค– Android

Build failed

๐Ÿ› Bug Report

Trying to use the plugin by following the README.

Build fails with:

Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "/work/workspaces/my-app/android/gradlew" exited abnormally:
WARNING: The specified Android SDK Build Tools version (25.0.3) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.2.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':permission_handler'.
> Failed to notify project evaluation listener.
   > java.lang.AbstractMethodError (no error message)

* 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 4s
  Command: /work/workspaces/my-app/android/gradlew app:properties

Finished with error: Please review your Gradle project setup in the android/ folder.

By doing:

 cd android/
gradlew app:properties --stacktrace

I get:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':permission_handler'.
> Failed to notify project evaluation listener.
   > java.lang.AbstractMethodError (no error message)

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':permission_handler'.
        at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:94)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:89)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:70)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.access$100(LifecycleProjectEvaluator.java:34)
        at org.gradle.configuration.project.LifecycleProjectEvaluator$ConfigureProject.run(LifecycleProjectEvaluator.java:110)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:50)
        at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:666)
        at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:135)
        at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:35)
        at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:62)
        at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:38)
        at org.gradle.initialization.DefaultGradleLauncher$ConfigureBuild.run(DefaultGradleLauncher.java:249)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
        at org.gradle.initialization.DefaultGradleLauncher.configureBuild(DefaultGradleLauncher.java:167)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:126)
        at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:109)
        at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:78)
        at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:75)
        at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:152)
        at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:100)
        at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:75)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$1.run(RunAsBuildOperationBuildActionRunner.java:43)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
        at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:47)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:57)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:32)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:69)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:30)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:45)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.internal.event.ListenerNotificationException: Failed to notify project evaluation listener.
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:86)
        at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:324)
        at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:234)
        at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:140)
        at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
        at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
        at com.sun.proxy.$Proxy26.afterEvaluate(Unknown Source)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:76)
        ... 81 more
Caused by: java.lang.AbstractMethodError
        at org.jetbrains.kotlin.gradle.plugin.KotlinPluginKt.resolveSubpluginArtifacts(KotlinPlugin.kt:793)
        at org.jetbrains.kotlin.gradle.plugin.KotlinPluginKt.loadSubplugins(KotlinPlugin.kt:767)
        at org.jetbrains.kotlin.gradle.plugin.KotlinPluginKt.access$loadSubplugins(KotlinPlugin.kt:1)
        at org.jetbrains.kotlin.gradle.plugin.AbstractAndroidProjectHandler$handleProject$2.execute(KotlinPlugin.kt:566)
        at org.jetbrains.kotlin.gradle.plugin.AbstractAndroidProjectHandler$handleProject$2.execute(KotlinPlugin.kt:501)
        at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:91)
        at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:80)
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
        at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:230)
        at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:149)
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
        ... 88 more

Expected behavior

I would expect the app to deploy.

Reproduction steps

pubspec.yaml

dependencies:
    flutter:
        sdk: flutter

    # The following adds the Cupertino Icons font to your application.
    # Use with the CupertinoIcons class for iOS style icons.
    cupertino_icons: ^0.1.2
    path_provider: '>=0.3.0'
    sqflite: any
    uuid: 2.0.0
    quiver: '>=2.0.0 <3.0.0'
    flutter_speed_dial: ^1.1.1
    contacts_service: '>=0.1.1'
    permission_handler: '^2.2.0'

contacts_list.dart

import 'package:contacts_service/contacts_service.dart';
import 'package:permission_handler/permission_handler.dart';

function with my test code:

	_addContact(BuildContext context) async {
		print("_addContact called");
		
		Map<PermissionGroup, PermissionStatus> permissions = await PermissionHandler().requestPermissions([PermissionGroup.contacts]);
		
		ServiceStatus serviceStatus = await PermissionHandler().checkServiceStatus(PermissionGroup.contacts);
		
		if (serviceStatus == ServiceStatus.enabled) {
			Iterable<Contact> contacts = await ContactsService.getContacts();
			print('Found ${contacts.length} contacts');
		} else {
			print('Permissions not granted');
		}
	}

Configuration

Version: 2.2.0

Platform:

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android (emulator of Pixel 2 with Android 28)

support-compat version problem causes build failure

๐Ÿ› Bug Report

After adding the plugin to pubspec.yaml, the project fails to build:
`FAILURE: Build failed with an exception.

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

Android dependency 'com.android.support:support-compat' has different version for the compile (27.0.2) and runtime (27.1.1) classpath. You should manually set the same version via DependencyResolution
`

Expected behavior

Successful build.

Reproduction steps

Build a project with these plugins in pubspec.yaml:

name: flutter_app
description: A new Flutter application.

dependencies:
  http: "^0.11.3+16"
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.0
  cached_network_image: "^0.4.0"
  firebase_auth: ^0.5.20
  intl: ^0.15.6
  flutter_launcher_icons: "^0.6.1"
  font_awesome_flutter: ^8.0.1
  flutter_facebook_login: ^1.1.1
  google_sign_in: ^3.0.5
  shared_preferences: ^0.4.3
  location: ^1.4.1
  permission_handler: '^2.0.0'

flutter_icons:
  image_path: "icon/u.png"
  android: trued
  ios: true

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:
  uses-material-design: true

Configuration

Version: 1.x and 2.x

Platform:

  • ๐Ÿ“ฑ iOS
  • [x ] ๐Ÿค– Android

็‰ˆๆœฌ้—ฎ้ข˜

๐Ÿ’ฌ Questions and Help

2.2.0็‰ˆๆœฌiosๆŠฅ้”™๏ผŒpermission_handler-Swift.hๆ‰พไธๅˆฐ๏ผŒandroidๅฏ็”จ๏ผŒ3.0.0้ƒฝๅฏไปฅ็”จ๏ผŒไธบไป€ไนˆ่ฆๆŽจ่2.2.0ๅ‘ข

Forgot Permission status after clear data in android

๐Ÿ› Bug Report

very first time grant permission then do clear data in android app, run app again its forgot permission is granted or not.

Expected behavior

ask permission again if clear data

Reproduction steps

as explained first grand permission then do clear data. now again check in app permission is granted or not.

Configuration

Version: ^2.1.2

Platform:

  • [] ๐Ÿค– Android

Does not build in Android due to duplicate class

๐Ÿ› Bug Report

I had started using this package as other ones are not building with iOS. Now this one works for iOS, but to my dismay won't even compile properly in Android.

Expected behavior

Should compile and run in an Android phone.

Reproduction steps

Use the package in your project, use an Android phone to build into

Configuration

Version: 2.2.0

Platform:

  • ๐Ÿ“ฑ iOS
    Works without any issues
  • ๐Ÿค– Android
    Won't even compile and here's the log
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: /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/2.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/3.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/4.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/5.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/6.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/7.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/8.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/9.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/10.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/11.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/12.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/13.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/14.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/15.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/16.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/17.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/18.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/19.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/20.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/21.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/22.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/23.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/24.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/25.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/26.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/27.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/28.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/29.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/30.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/31.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/32.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/33.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/34.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/35.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/36.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/37.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/38.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/39.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/40.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/41.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/42.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/43.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/44.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/45.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/46.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/47.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/48.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/49.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/50.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/51.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/52.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/53.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/54.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/55.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/56.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/57.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/58.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/59.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/60.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/61.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/62.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/63.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/64.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/65.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/66.jar, /Users/apple/AndroidStudioProjects/cityjan-flutter-project/build/app/intermediates/transforms/dexBuilder/debug/67.jar
  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 2m 38s
Finished with error: Gradle task assembleDebug failed with exit code 1

Permission dialogs are not popping up

๐Ÿ› Bug Report

Inserted the permission boiler-plate code but permission dialogs are not popping up

Map<PermissionGroup, PermissionStatus> permissions = await PermissionHandler().requestPermissions([PermissionGroup.location]);

I also inserted the permission in the Android Manifest
<uses-permission android:name="android.permission.LOCATION"/>

Version: 2.1.2

Platform:

  • ๐Ÿ“ฑ iOS
  • [Y] ๐Ÿค– Android

Android's "don't ask again"

๐Ÿš€ Feature Requests

Android's permission dialog gives the user the option to "Don't Ask Again".

I must know, through the PermissionStatus enum, if the user selected that option. That's because, if I can't ask again, I must tell the user to go to the device's settings screen to give me the necessary permissions.

I suggest creating PermissionStatus.dontAskAgain.

Crash when accessing location twice

๐Ÿ› Bug Report

See Baseflow/flutter-geolocator#131

I think it's more related to this plugin then the geolocator plugin.

My stacktrace:

[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(ERROR_ALREADY_REQUESTING_PERMISSIONS, A request for permissions is already running, please wait for it to finish before doing another request (note that you can request multiple permissions at the same time)., null)
    #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:564:7)
    #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:302:33)
    <asynchronous suspension>
    #2      PermissionHandler.requestPermissions (package:permission_handler/src/permission_handler.dart:66:30)
    <asynchronous suspension>
    #3      Geolocator._getLocationPermission (package:geolocator/geolocator.dart:184:16)
    <asynchronous suspension>
    #4      Geolocator.getPositionStream (package:geolocator/geolocator.dart:162:47)
    <asynchronous suspension>
    #5      new RestaurantWidgetState.<anonymous closure> (package:taurant_app/widgets.dart:208:22)
    #6      _rootRunUnary (dart:async/zone.dart:1132:38)
    #7      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
    #8      _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
    #9      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
    #10     Future._propagateToListeners (dart:async/future_impl.dart:668:32)
    #11     Future._complete (dart:async/future_impl.dart:473:7)
    #12     _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
    #13     _AsyncAwaitCompleter.complete (dart:async/runtime/libasync_patch.dart:28:18)
    #14     _completeOnAsyncReturn (dart:async/runtime/libasync_patch.dart:294:13)
    #15     Geolocator.isLocationServiceEnabled (package:geolocator/geolocator.dart)
    <asynchronous suspension>
    #16     new RestaurantWidgetState (package:taurant_app/widgets.dart:206:18)
    #17     RestaurantWidget.createState (package:taurant_app/widgets.dart:200:12)
    #18     new StatefulElement (package:flutter/src/widgets/framework.dart:3804:25)
    #19     StatefulWidget.createElement (package:flutter/src/widgets/framework.dart:805:38)
    #20     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2954:40)
    #21     Element.updateChild (package:flutter/src/widgets/framework.dart:2759:12)
    #22     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
    #23     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2956:14)
    #24     Element.updateChild (package:flutter/src/widgets/framework.dart:2759:12)
    #25     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
    #26     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2956:14)
    #27     Element.updateChild (package:flutter/src/widgets/framework.dart:2759:12)
    #28     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3747:16)
    #29     Element.rebuild (package:flutter/src/widgets/framework.dart:3559:5)
    #30     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3716:5)
    #31     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3711:5)
    #32     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2956:14)
    #33     Element.updateChild (package:flutter/src/widgets/framework.dart:2759:12)
    #34     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3747:16)
    #35     Element.rebuild (package:flutter/src/widgets/framework.dart:3559:5)
    #36     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3716:5)
    #37     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3711:5)
    #38     ParentDataElement.mount (package:flutter/src/widgets/framework.dart:4063:11)
    #39     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2956:14)
    #40     Element.updateChild (package:flutter/src/widgets/framework.dart:2759:12)
    #41     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3747:16)
    #42     Element.rebuild (package:flutter/src/widgets/framework.dart:3559:5)
    #43     ComponentElement._firstBuild (package:flutter/src

Build failed because of Kotlin Gradle plugin version

๐Ÿ› Bug Report

When I have added the library to my project it failed to build.
FAILURE: Build failed with an exception.

  • What went wrong:
    The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher.
    The following dependencies do not satisfy the required version:
    project ':permission_handler' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71

Expected behavior

Build should be successful

Reproduction steps

Add the library to project with androidX support

Version: 1.x

Platform:

  • ๐Ÿ“ฑ iOS
  • [v] ๐Ÿค– Android

iOS gives more preference to disabled status then denied status

๐Ÿ› Bug Report

If location services is off, and your app has not given permission, and you check for permission status, then disabled status is returned instead of denied.

Expected behavior

The correct behavior would be it should first check if the permission is granted and if the answer is yes, then it should check for location services if they are on or off.

Reproduction steps

Make sure the location services is off (GPS) in iOS and your app has not asked for permission before. Now ask for the permission very first time, the status returned would be PermissionStatus.disabled instead of PermissionStatus.denied or PermissionStatus.unknown. However if location services is on and you ask for permission then it works as expected and returns PermissionStatus.unknown

PermissionStatus status = await PermissionHandler().checkPermissionStatus(PermissionGroup.locationAlways);

Result

status = PermissionStatus.disabled (if location is off not matter if permission is given to your app or not) -- NOT EXPECTED, the status should first check if permission is granted or not, if permission is granted then it should check if location is disabled or not.

status = PermissionStatus.unknown (if location is on and permission is not asked before) -- EXPECTED

Version: 2.1.2

Platform:
iOS 12.0.1 running in iPhone 6s

PermissionStatus.DISABLED isn't supported

๐Ÿ› Bug Report

Hi,

although the API suggests that it will report DISABLED as status if a service is disabled/not available this part seems not to be implemented yet (at least in the Android code) at all which leads to the same problem in your geo_locator, see Baseflow/flutter-geolocator#108

Please add a check if the service is avaliable before returning a GRANTED/DENIED.

Thanks
Thomas

If location is set on battery saving (GPS off), checkPermissionStatus returns ServiceStatus.enabled

๐Ÿ› Bug Report

In Android, when you have location set to Battery Saving, and you check for service status using

ServiceStatus status = await PermissionHandler().checkServiceStatus(PermissionGroup.locationWhenInUse);

The status returned is ServiceStatus.enabled.

Expected behavior

The status returned should be ServiceStatus.disabled because Battery saving doesn't show location updates.

Solution

You need to use something like this in your java code

LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
boolean isGpsOn = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);

The value of isGpsOn is true for

  1. High accuracy
  2. Device only

and false for Battery saving mode

image

Version

version: "3.0.0"

Platform:
Android

Error: failed linking references during Android Build

๐Ÿ› Bug Report

Just added the extension permission_handler: ^2.2.0 in to pubspec.yaml and the app cannot build anymore. When i remove the extension. it runs. Error in terminal is shown below

##Terminal Output

Gradle task 'assembleDebug'...
C:\Users\DELL XPS 1215\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\b00b11c474fd5b2fa5cce68c7d37ba42\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/fontVariationSettings not found.

C:\Users\DELL XPS 1215\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\b00b11c474fd5b2fa5cce68c7d37ba42\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/ttcIndex not found.

D:\Cognate\opine-app\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:332: error: resource android:attr/fontVariationSettings not found.
D:\Cognate\opine-app\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:332: error: resource android:attr/ttcIndex not found.
error: failed linking references.

Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
        at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
        at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
        at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)
        at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
        at sun.reflect.GeneratedMethodAccessor1588.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
        at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
        at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
        at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
        at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:794)
        ... 47 more
Caused by: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
        at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
        at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)
        at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
        at com.android.builder.internal.aapt.v2.QueueableAapt2.lambda$makeValidatedPackage$1(QueueableAapt2.java:179)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        ... 1 more
Caused by: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
        at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:463)
        at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:415)
        at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:332)
        at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

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

BUILD FAILED in 40s`

Reproduction steps

Add extension permission_handler: ^2.2.0 in to pubspec.yaml and build apk using flutter run

Version:^2.2.0

Platform:

  • [*] ๐Ÿค– Android

2.1.3 is a breaking change on android

๐Ÿ— Enhancement Proposal

When a breaking change is done please make a bigger change to the version.
The upgrade to androidX breaks builds with the old android support library.

Pitch

If 2.1.3 was 3.0.0 my gradle build would not have failed and alot of gradle version hell could have been avoided.

Platforms affected (mark all that apply)

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

And by the way: Thank you for a nice plugin.

PermissionHandler and GeoLocator mix up things

๐Ÿ› Bug Report

Please don't get me wrong with the title. Let me explain the things, when in Android, you ask for location permission, user can either accept or deny the permission, whatever he does the status returned in both cases is PermissionStatus.disabled (mentioned the location is off in user device), so the developer can't get to know whether the permission was accepted or denied by the user.

I think you guys have mixed up permission and location.

Expected behavior

PermissionHandler should only check for permission stuff not the location one. Geolocator should only check for location on/off. Or if you want to combine, then please handle all the use cases.

Version:
2.1.1

Platform:
Android

A problem occurred configuring project ':permission_handler'.

๐Ÿ› Bug Report

I'm using the permission_handler library in my Flutter project. It builds fine on iOS, but throws an error when I try to build on Android. It configures all my other plugins correctly, but it fails on this one for some reason.
screen shot 2018-10-18 at 2 29 27 pm

Maybe this is conflicting with a Kotlin or Gradle version? My Kotlin version is 1.2.51, Gradle is 3.2.1, targetSdkVersion is 27.

As recommended by this flutter issue comment, I also have this included in my project level build.gradle file:

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "26.1.0"
            }
        }
    }
}

Expected behavior

Plugin builds successfully.

Reproduction steps

Build Flutter project on Android with most recent permission_handler library as dependency.

Configuration

Version: 2.1.0

Platform:

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

App crashed due to java.lang.IllegalStateException

๐Ÿ› Bug Report

Here is the crash report that i have received from Google Play Console
Only few devices are affected by this issue.

java.lang.RuntimeException: 
  at android.app.ActivityThread.deliverResults (ActivityThread.java:4491)
  at android.app.ActivityThread.handleSendResult (ActivityThread.java:4534)
  at android.app.ActivityThread.-wrap20 (Unknown Source)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1752)
  at android.os.Handler.dispatchMessage (Handler.java:105)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:6944)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
Caused by: java.lang.IllegalStateException: 
  at io.flutter.view.FlutterNativeView$1.reply (FlutterNativeView.java:174)
  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success (MethodChannel.java:203)
  at com.baseflow.permissionhandler.PermissionHandlerPlugin.processResult (PermissionHandlerPlugin.kt:286)
  at com.baseflow.permissionhandler.PermissionHandlerPlugin.handlePermissionsRequest (PermissionHandlerPlugin.kt:278)
  at com.baseflow.permissionhandler.PermissionHandlerPlugin.access$handlePermissionsRequest (PermissionHandlerPlugin.kt:27)
  at com.baseflow.permissionhandler.PermissionHandlerPlugin$Companion$registerWith$1.onRequestPermissionsResult (PermissionHandlerPlugin.kt:45)
  at io.flutter.app.FlutterPluginRegistry.onRequestPermissionsResult (FlutterPluginRegistry.java:191)
  at io.flutter.app.FlutterActivityDelegate.onRequestPermissionsResult (FlutterActivityDelegate.java:125) 
  at io.flutter.app.FlutterActivity.onRequestPermissionsResult (FlutterActivity.java:133)
  at android.app.Activity.dispatchRequestPermissionsResult (Activity.java:7737)
  at android.app.Activity.dispatchActivityResult (Activity.java:7560)
  at android.app.ActivityThread.deliverResults (ActivityThread.java:4487)

Reproduction steps

This crash was on user side so i can't specify the steps.

Configuration

Version: 2.1.1

Platform:

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

ios 12.1 No Runtime Popup coming

๐Ÿ› Bug Report

A popup should come out to accept location or deny

Configuration

Info.plist has these
NSLocationAlwaysUsageDescription
Provide Location Access
NSLocationAlwaysAndWhenInUseUsageDescription
Provide Location Access

My Code is as follows:
Future _getLocationPermission() async {
try {
if ( _loctionPermissionStatus == null || _loctionPermissionStatus == PermissionStatus.denied ) {

  Map<PermissionGroup, PermissionStatus> locationPermisson =  await permissonhandler
    .requestPermissions([PermissionGroup.location]);
    _loctionPermissionStatus = locationPermisson[PermissionGroup.location];
    return _loctionPermissionStatus;
  }
}
catch(e) {
  print(e);
} 
return _loctionPermissionStatus;

}

await requestPermissions is not returning any response and stuck forever
Version: 2.1.2

Platform:

  • [ Y ] ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

Switch detection of notification messages on iOS

๐Ÿš€ Feature Requests

On the iOS platform, the permission check for message notifications is urgently needed.

Contextualize the feature

Describe the feature

Check the permissions as you do for other permissions. If you refuse, open the settings page.

Platforms affected (mark all that apply)

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

Add cocoapods' static_framework support

๐Ÿš€ Feature Requests

add cocoapods' static_framework support
CocoaPods/CocoaPods#6811

Contextualize the feature

We must add use_frameworks! at Podfile, but after add these configurations, will cause many problems such as below:

error: exportArchive: permission_handler.framework does not support provisioning profiles.

Error Domain=IDEProvisioningErrorDomain Code=10 "permission_handler.framework does not support provisioning profiles." UserInfo={NSLocalizedDescription=permission_handler.framework does not support provisioning profiles., NSLocalizedRecoverySuggestion=permission_handler.framework does not support provisioning profiles, but provisioning profile match AdHoc com.xxx.app has been manually specified. Remove this item from the "provisioningProfiles" dictionary in your Export Options property list.}

and that will cause the Archive success but Sign failed error.

Describe the feature

CocoaPods version 1.3.1 and earlier do not support static framework
dependencies.CocoaPods 1.4.0 adds thestatic_framework option in #6811 that enables you
to specify building a pod as a static_framework, which unlike dynamic frameworks, can have static framework dependencies.

add s.static_framework = true to .podspec

Platforms affected (mark all that apply)

  • ๐Ÿ“ฑ iOS

Add WRITE_SMS Permission and Setting as Default SMS Application

๐Ÿš€ Feature Requests

WRITE_SMS Permission

Contextualize the feature

Sorry, don't understand this

Describe the feature

This would allow the app to write SMS to the phone. It should also allow the setting of the app as the default SMS application and allow changing back the default SMS application as well since this permission would be pointless without the option to set as default.

Platforms affected (mark all that apply)

  • ๐Ÿ“ฑ iOS
  • [โœ“] ๐Ÿค– Android

Request permission not wait for user action

๐Ÿ› Bug Report

Code Snippet

    PermissionStatus permission = await PermissionHandler()
        .checkPermissionStatus(PermissionGroup.location);
    if (permission == PermissionStatus.unknown ||
        permission == PermissionStatus.denied) {
      Map<PermissionGroup, PermissionStatus> permissions =
          await PermissionHandler()
              .requestPermissions([PermissionGroup.location]);

      if (permissions[PermissionGroup.location] == PermissionStatus.granted) {
        platform.invokeMethod('locationPermissionGranted');
      }
    }

Expected behavior

While I am using async await to wait for user to take action, it should call next line only after user user take any action, but next line is never execute, I tried print and break point.

Reproduction steps

Try put the code in blank flutter app and call a function after permission received.

Configuration

Version:
Flutter version:-

Flutter 0.9.4 โ€ข channel beta โ€ข https://github.com/flutter/flutter.git
Framework โ€ข revision f37c235c32 (7 weeks ago) โ€ข 2018-09-25 17:45:40 -0400
Engine โ€ข revision 74625aed32
Tools โ€ข Dart 2.1.0-dev.5.0.flutter-a2eb050044

Platform:

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

Building for iOS fails plugin version 2.1.2

๐Ÿ› Bug Report

Building for iOS fails

=== BUILD TARGET url_launcher OF PROJECT Pods WITH CONFIGURATION Debug ===
/Development/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.2/ios/Classes/PermissionManager.swift:50:45: error: type 'UIApplication' has no member 'UIApplicationOpenSettingsURLString'
guard let url = URL(string: UIApplication.UIApplicationOpenSettingsURLString),
^~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Development/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.2/ios/Classes/PermissionManager.swift:59:77: error: type 'UIApplication' has no member 'UIApplicationOpenSettingsURLString'
let success = UIApplication.shared.openURL(URL.init(string: UIApplication.UIApplicationOpenSettingsURLString)!)

Version: 2.1.2

Platform:

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

Doesn't support Android X and build keeps breaking

Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library.

Dialog not shown

๐Ÿ’ฌ Questions and Help

For questions or help we recommend checking:

  • The Flutter tag in Stack Overflow
    Hi I just copied you repo, I enabled the location for an app initially. No turned it off, using your plugin I expected to show a dialog to enabled it. But nothing that I see.

XCode build fails

Hi, I'm trying to use this library and it works great in Android, but when I try to build for iOS (after applying the fix in the description) it fails with the following output:

With config.build_settings['SWIFT_VERSION'] = '4.1' in Podfile

Error output from Xcode build:
โ†ณ
   2018-11-26 19:04:07.144 xcodebuild[20997:3693078]  DVTAssertions: Warning in
   /Library/Caches/com.apple.xbs/Sources/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-13756/Xcode3Core/LegacyProjects/Frameworks/DevToolsCore/DevToolsCore/BuildSystem/Runtime/PB
   XTargetBuildContext.mm:757
   Details:  unexpected successful exit code from cancelled command <C0007:'CpHeader LocationPlugin.h':P8>
   Object:   <PBXTargetBuildContext: 0x7ff2a59d3f30>
   Method:   -createCommandInvocationRecordFromInvocation:
   Thread:   <NSThread: 0x7ff2a55bb360>{number = 5, name = (null)}
   Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
   ** BUILD FAILED **


Xcode's output:
โ†ณ
   /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/PermissionManager.swift:94:118: error: 'OpenExternalURLOptionsKey' is
   not a member type of 'UIApplication'
   fileprivate func convertToUIApplicationOpenExternalURLOptionsKeyDictionary(_ input: [String: Any]) -> [UIApplication.OpenExternalURLOptionsKey: Any] {
                                                                                                          ~~~~~~~~~~~~~ ^
   /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/PermissionManager.swift:55:77: error: type 'UIApplication' has no
   member 'openSettingsURLString'
                   let success = UIApplication.shared.openURL(URL.init(string: UIApplication.openSettingsURLString)!)
                                                                               ^~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
   /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.2.5+1/ios/Classes/FirebaseCorePlugin.m:13:17: warning: property 'dictionary' requires
   method 'dictionary' to be defined - use @dynamic or provide a method implementation in this category [-Wobjc-property-implementation]
   @implementation FIROptions (FLTFirebaseCorePlugin)
                   ^
   /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.2.5+1/ios/Classes/FirebaseCorePlugin.m:10:46: note: property declared here
   @property(readonly, nonatomic) NSDictionary *dictionary;
                                                ^
   1 warning generated.

With config.build_settings['SWIFT_VERSION'] = '3.2' in Podfile

Xcode's output:
โ†ณ
    === BUILD TARGET FirebaseAuth OF PROJECT Pods WITH CONFIGURATION Debug ===
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/strategies/AudioVideoPermissionStrategy.swift:14:80: error: type
    'AVMediaType' (aka 'NSString') has no member 'video'
                return AudioVideoPermissionStrategy.getPermissionStatus(mediaType: AVMediaType.video)
                                                                                   ^~~~~~~~~~~ ~~~~~
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/strategies/AudioVideoPermissionStrategy.swift:16:80: error: type
    'AVMediaType' (aka 'NSString') has no member 'audio'
                return AudioVideoPermissionStrategy.getPermissionStatus(mediaType: AVMediaType.audio)
                                                                                   ^~~~~~~~~~~ ~~~~~
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/strategies/AudioVideoPermissionStrategy.swift:23:86: error:
    'AVMediaType' (aka 'NSString') is not implicitly convertible to 'String!'; did you mean to use 'as' to explicitly convert?
            let status: AVAuthorizationStatus = AVCaptureDevice.authorizationStatus(for: mediaType)
                                                                                         ^
                                                                                                   as String!
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/strategies/AudioVideoPermissionStrategy.swift:48:25: error: type
    'AVMediaType' (aka 'NSString') has no member 'video'
                mediaType = AVMediaType.video
                            ^~~~~~~~~~~ ~~~~~
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/strategies/AudioVideoPermissionStrategy.swift:50:25: error: type
    'AVMediaType' (aka 'NSString') has no member 'audio'
                mediaType = AVMediaType.audio
                            ^~~~~~~~~~~ ~~~~~
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/strategies/AudioVideoPermissionStrategy.swift:56:44: error:
    'AVMediaType' (aka 'NSString') is not implicitly convertible to 'String!'; did you mean to use 'as' to explicitly convert?
            AVCaptureDevice.requestAccess(for: mediaType, completionHandler: {
                                               ^
                                                         as String!
    === BUILD TARGET FirebaseAuth OF PROJECT Pods WITH CONFIGURATION Debug ===
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/PermissionManager.swift:94:118: error: 'OpenExternalURLOptionsKey' is
    not a member type of 'UIApplication'
    fileprivate func convertToUIApplicationOpenExternalURLOptionsKeyDictionary(_ input: [String: Any]) -> [UIApplication.OpenExternalURLOptionsKey: Any] {
                                                                                                           ~~~~~~~~~~~~~ ^
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/PermissionManager.swift:55:77: error: type 'UIApplication' has no
    member 'openSettingsURLString'
                    let success = UIApplication.shared.openURL(URL.init(string: UIApplication.openSettingsURLString)!)
                                                                                ^~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~

Any help is greatly appreciated. Thanks for making permission handling easier for the rest of us! :)

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

Always says "No permissions found in manifest"

๐Ÿ’ฌ Questions and Help

Hello,

I copied and paste the example: https://github.com/BaseflowIT/flutter-permission-handler/tree/develop/example both main.dart and the permissions inside AndroidManifest.xml.

The message is always the same:

Launching lib/main.dart on SM G935F in debug mode...
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...
Syncing files to device SM G935F...
D/libGLESv2( 2235): STS_GLApi : DTS, ODTC are not allowed for Package : com.example.flutter_app
D/permissions_handler( 2235): No permissions found in manifest for: $permission
I/chatty  ( 2235): uid=10519(u0_a519) com.example.flutter_app identical 5 lines
D/permissions_handler( 2235): No permissions found in manifest for: $permission
D/permissions_handler( 2235): No permissions found in manifest for: $permission
I/chatty  ( 2235): uid=10519(u0_a519) com.example.flutter_app identical 3 lines
D/permissions_handler( 2235): No permissions found in manifest for: $permission
D/ViewRootImpl@6bcba18[MainActivity]( 2235): ViewPostIme pointer 0
D/ViewRootImpl@6bcba18[MainActivity]( 2235): ViewPostIme pointer 1
D/permissions_handler( 2235): No permissions found in manifest for: $permission
I/flutter ( 2235): decodePermissionRequestResult called with: value:[{0: 4}]
I/flutter ( 2235): {PermissionGroup.calendar: PermissionStatus.unknown}
I/flutter ( 2235): PermissionStatus.unknown

No matter what I do. Even tried more simple code, like just asking for one permission clicking a button.

I do have all the permissions on manifest.

Any clues?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.