Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(android): switch to new callback-style permission requests #4033

Merged
merged 25 commits into from Jan 8, 2021

Conversation

carlpoole
Copy link
Member

Changes

  • PluginState enum replaces raw strings representing the state of a permission
  • Permission response codes are no longer necessary and have been removed
  • Behavior run after permission grant/deny is defined in a callback method.
  • Permission callback methods are defined on the plugin class with the signature format private void myPermissionCallback(PluginCall, Map<String, PluginState>)
  • PluginMethods that result in permission request calls must specify the name of a callback method in the @PluginMethod annotation, for example: @PluginMethod(permissionCallback = "myPermissionCallback")
  • The permissionCallback annotation element is important in registering the permission callback in the Activity lifecycle and ensuring the code is run after permission is granted/denied.

2.x

  • For backwards compatibility with 2.x, any plugins defined with a permission response code in a @NativePlugin annotation will be handled first before delegating the permission handling to Android for the new callback method.

@carlpoole carlpoole moved this from In progress 🤺 to Needs review 🤔 in Capacitor Engineering ⚡️ Jan 8, 2021
@imhoffd imhoffd added this to the 3.0.0-beta milestone Jan 8, 2021
@imhoffd imhoffd changed the title feat(android): permission requesting using the new AndroidX Activity v1.2 permission request flow feat(android): switch to new callback-style permission requests Jan 8, 2021
@imhoffd imhoffd merged commit cc459de into main Jan 8, 2021
Capacitor Engineering ⚡️ automation moved this from Needs review 🤔 to Done 🎉 Jan 8, 2021
@imhoffd imhoffd deleted the perms-1.2 branch January 8, 2021 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants