flutter-permission-handler icon indicating copy to clipboard operation
flutter-permission-handler copied to clipboard

Add TargetApi annotation in PermissionUtils.java for Android

Open victorsanni opened this issue 2 years ago • 2 comments

This adds the TargetApi annotation to the getManifestNames method in PermissionUtils.java. On Android, not including the TargetApi annotation to the getManifestNames method in PermissionUtils.java causes StrictMode errors: https://developer.android.com/reference/android/os/StrictMode.

List at least one fixed issue.

Pre-launch Checklist

  • [x] I made sure the project builds.
  • [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • [x] I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is does not need version changes.
  • [x] I updated CHANGELOG.md to add a description of the change.
  • [x] I updated/added relevant documentation (doc comments with ///).
  • [x] I rebased onto main.
  • [x] I added new tests to check the change I am making, or this PR does not need tests.
  • [x] I made sure all existing and new tests are passing.
  • [x] I ran dart format . and committed any changes.
  • [x] I ran flutter analyze and fixed any errors.

victorsanni avatar Aug 08 '23 22:08 victorsanni

Hi @victorsanni,

Can you elaborate why these changes are required? Both Android and iOS are building just fine at the moment and it seems that your changes break the build with the following error in CI:

Lexical or Preprocessor Issue (Xcode): 'strategies/AudioVideoPermissionStrategy.h' file not found
/Users/runner/work/flutter-permission-handler/flutter-permission-handler/permission_handler_apple/ios/Classes/PermissionManager.h:11:8

Parse Issue (Xcode): Could not build module 'permission_handler_apple'
/Users/runner/work/flutter-permission-handler/flutter-permission-handler/permission_handler_apple/example/ios/Runner/GeneratedPluginRegistrant.m:9:8

mvanbeusekom avatar Aug 09 '23 06:08 mvanbeusekom

On Android, not including the TargetApi annotation to the getManifestNames method in PermissionUtils.java causes StrictMode errors: https://developer.android.com/reference/android/os/StrictMode

Same with the implicit fallthrough.

I have reverted the iOS import changes and will move the fallthrough comment to its own PR.

victorsanni avatar Aug 09 '23 22:08 victorsanni