proomt

Search

Search posts, papers, and topics

All posts

CodeName OneShai Almog3 min readtutorialintermediate

Pick One Contact Without Asking for the Address Book

Summary

Codename One adds a permission‑free `ContactPicker` API that uses the Android 17 system contact picker and iOS `CNContactPickerViewController` to let apps request only the specific fields (name, phone, etc.) they need. The picker returns a snapshot `Contact` object without granting broad address‑book access, and the API gracefully falls back on older platforms or unsupported cases.

  • Use `ContactPicker.setRequestedFields()` to declare needed fields (e.g., `NAME | PHONE`) and handle the result in the callback; the returned `Contact` is a one‑time snapshot.
  • On Android 17+ the picker uses `ACTION_PICK_CONTACTS`; older Android falls back to `ACTION_PICK` with limited field support.
  • iOS implementation uses `CNContactPickerViewController` and does not require `NSContactsUsageDescription` because the user selects data via a system UI.
  • The API reports support via `ContactPicker.isSupported()`. When unsupported, apps should provide a manual entry UI.

Broad contacts permission is a privacy risk and a UX friction point. By limiting access to only the data a screen actually needs, developers can reduce permission prompts, improve user trust, and simplify compliance with platform privacy guidelines. The API also aligns with Android 17’s new privacy…

6/10

Related reading

  1. We Stopped Waiting for Platform Changes to Find Us

    Codename One added a daily automated scan of Apple and Google deprecation notices, linking each notice to concrete builder artifacts before work is created. The system caught the Android 16 back‑gesture change and enabled a permission‑free ContactPicker, turning policy shifts into repeatable, evidence‑backed patches.

    CodeName Onecodenameone.com3 min
  2. Tapjacking Protection: Rejecting Android Touches Behind an Overlay

    Codename One adds tapjacking protection to its Android runtime. It detects fully or partially obscured MotionEvents, offers four policies (OFF, REPORT, BLOCK, STRICT), can block the entire gesture, and on Android 12+ can request the system hide overlay windows. The API is exposed via `DeviceIntegrity.setTapjackingProtection` and a listener for state changes. iOS has no overlay threat, so the feat…

    CodeName Onecodenameone.com3 min
  3. Fill an SMS Verification Code Without Reading the Inbox

    Codename One adds a one‑time‑code autofill component that leverages iOS, Android, and browser autofill APIs, eliminating the need for SMS‑reading permissions. The new `PhoneVerification` component handles phone entry, code entry, resend timing, and server callbacks, while the UI uses a single hidden editor to back six visual boxes, improving typing, paste, and accessibility. The post explains the…

    CodeName Onecodenameone.com3 min
  4. Put App Documents in the System File Browser

    Codename One adds a read‑only DocumentProvider API that lets apps publish a virtual file tree to iOS Files and Android’s storage picker. The tree is defined with `DocumentNode` objects, can include remote‑only entries, and is shared via an App Group container. The iOS extension runs in a separate process, so the model is serialized and read independently; Android uses the same model inside the ap…

    CodeName Onecodenameone.com4 min
  5. Android 17 Without the Last-Minute Scramble

    CodeName One prepared for Android 17 (API 37) by addressing platform changes proactively, including fixing version number parsing and implementing the new system-rendered location button. They also added robust PEM key parsing and explicit task removal to simplify common security operations for app developers.

    CodeName Onecodenameone.com8 min