Repository navigation
feat: add pickContactField to avoid contacts permissions on Android - #12
Merged
Merged
Conversation
…missions
Add pickContactField({ field }) that opens the system picker restricted to one kind of information (phone, email or address) and resolves with only the picked value, its label and the contact's display name, as a new PickedContactField. It needs no contacts permission, so apps can drop READ_CONTACTS when they only use this method.
- Android: ACTION_PICK on the data-kind URI of the requested field, on every API level, with no compileSdk bump (Android 17 routes it to the new Contacts Picker)
- iOS: CNContactPickerViewController with displayedPropertyKeys and predicateForSelectionOfProperty, so the user taps a single value
- web: throws unimplemented, like the other methods
- example app: button to try the method, address on the saved contact, and explicit handling of errors that have no code
- pickContact is unchanged
References: https://outsystemsrd.atlassian.net/browse/RMET-5201
Includes UIScene migration to work on Xcode 27
OS-pedrogustavobilro
requested review from
ItsChaceD,
andredestro,
jcesarmobile,
markemer and
theproducer
November 20, 2026 14:27
OS-pedrogustavobilro
marked this pull request as ready for review
November 20, 2026 14:27
theproducer
approved these changes
Nov 23, 2026
Suggested in PR comment
Contributor
Author
|
Merging since I got an approval, should there be any concerns let me know post! Thanks! |
capacitor-bot
pushed a commit
that referenced
this pull request
Nov 23, 2026
# [1.1.0](v1.0.1...v1.1.0) (2026-11-23) ### Features * add pickContactField to avoid contacts permissions on Android ([#12](#12)) ([b74d0f3](b74d0f3))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
pickContactField({ field }), which opens the system contact picker for a single kind of information ('phone','email'or'address') and resolves with only the picked value (PickedContactField), not a fullContact. It needs no contacts permission.ACTION_PICKon the data-kind URI of the field, so the contacts app grants temporary read access to just the selected row. NoREAD_CONTACTS, and no compileSdk bump.CNContactPickerViewControllerlimited to the requested property, so the user selects one value.unimplemented, same as other methods.Also adds the Android error
OS-PLUG-CONT-0021, returned byfind,save,removeandpickContactwhen the permissions they need aren't declared in the app's manifest (usesisPermissionDeclared, like@capacitor/geolocation).pickContactis unchanged.Change Type
Rationale / Problems Fixed
Google Play is restricting
READ_CONTACTSfor apps targeting Android 17 (SDK 37), the Capacitor 9 default: https://support.google.com/googleplay/android-developer/answer/16909972#contacts-permissionsThe PR targets
main, because while it's technically only necessary for Capacitor 9 (2.xplugin version), there's no breaking changes that keep it from being in Capacitor 8 plugin version (1.x), and it also helps serve ODC customers better.We could remove the contacts permissions on Capacitor 9 version (breaking change), so that users add them instead of doing the
tools:node="remove". I'm not planning on doing that, but let me know if you feel otherwise.Apps that only need to pick a phone number, email or address can use
pickContactFieldand leave the contacts permissions out of their manifest.Related ticket: https://outsystemsrd.atlassian.net/browse/RMET-5201
Tests or Reproductions
pickContactField()button; the saved contact now includes an address).READ_CONTACTSandWRITE_CONTACTSfrom the example app's manifest as shown in the README.Platforms Affected
Notes / Comments
id(the permission-free picker doesn't expose the one used byfind,saveandremove).:::warningis for the Docusaurus pages).cap migraterun to make it work with Xcode 27.