capacitor-community / contacts

Contacts Plugin for Capacitor
https://capacitor-community.github.io/contacts/
119 stars 52 forks source link

Can you still request permissions on v4 Android? #89

Closed ChrisMott97 closed 1 year ago

ChrisMott97 commented 1 year ago

Describe the bug The docs say there's a requestPermissions() method, but I can't seem to see a PluginMethod in the android source for this method? I was looking for it to be sure of what the behavior was as we're migrating from the old @ionic-native/contacts plugin

I'm using Capacitor 4, and therefore v4-beta of this package

tafelnl commented 1 year ago

TLDR: upon using the plugin you will find that on Android (and iOS) it works exactly like the TypeScript definitions say it will. That means requestPermissions is in fact available.

Detailed explanation: It is indeed correct that for Android you won't find a requestPermissions method in the source code, although this is the case for the iOS source code. That is because Capacitor (from v3 on) supports a new way of requesting permissions on iOS and Android with the use of some helpers provided by the Capacitor SDK. Because on Android most (if not all) permissions can be requested the same way, the Capacitor team decided to abstract it away completely. You can find some more details about this in the docs (Android) (iOS)