capacitor-community / contacts

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

Feat: Do not require android.permission.WRITE_CONTACTS #119

Open qliqdev opened 4 months ago

qliqdev commented 4 months ago

Is your feature request related to a problem? Please describe. As we can see in plugin initialization code

@CapacitorPlugin(
    name = "Contacts",
    permissions = { @Permission(strings = { Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS }, alias = "contacts") }
)

Plugin requires Manifest.permission.WRITE_CONTACTS. that's why Google Play always throw annoying warning before publising release image

Describe the solution you'd like Permissions should be configurable by client side.

Describe alternatives you've considered It would be better if we could configure permissions in capasitor.confit.ts or when calling requestPermissions method

sergiomilici commented 4 months ago

I have the same issue. It's always requiring WRITE_PERMISSION when I just read the contacts.

reslear commented 1 month ago

I also encountered an error while trying to read contacts using the following code:

AndroidManifest.xml

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

Code

    const { contacts } = await Contacts.getContacts({
      projection: {
        name: true,
      },
    })

The error message I received is:

Msg: Error: Missing the following permissions in AndroidManifest.xml: android.permission.WRITE_CONTACTS

Application is requesting android.permission.WRITE_CONTACTS even though the intention is ONLY to READ contacts.

@tafelnl there's no way around it?