Skip to content

Fix Android quick actions registration - #6186

Draft
JP0P wants to merge 2 commits into
developfrom
codex/fix-quick-actions-android
Draft

Fix Android quick actions registration#6186
JP0P wants to merge 2 commits into
developfrom
codex/fix-quick-actions-android

Conversation

@JP0P

@JP0P JP0P commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • remove the unsafe Android currentActivity!! dependency by building shortcut intents from the package launch intent
  • keep the dynamic, localized, app-configurable shortcuts introduced in feat: add home screen long-press shortcuts via expo-quick-actions #6001
  • report any remaining registration failure without displaying a startup-blocking alert
  • keep user-visible errors when a user taps a shortcut and its URL cannot open

Why

Sentry issue EDGE-REACT-GUI-4T7J has approximately 1,600 production events affecting 891 users:

Call to function 'ExpoQuickActions.setItems' has been rejected.
→ Caused by: java.lang.NullPointerException

currentActivity!! is the old failure point, not the fix. expo-quick-actions 5.0.0 uses that Kotlin non-null assertion while constructing Android shortcut intents, so registration crashes when no Activity is available during JavaScript startup. The app caught that failure with showError, which displayed a large red alert even though quick actions are optional.

This patch uses the package launch intent, so shortcut registration does not require a foreground Activity. Unexpected registration failures are still reported to Sentry, but no longer interrupt startup.

Controlled Android A/B proof

Device: Pixel 6 Pro 18311FDEE000AS
Android build: CP1A.260405.005

Pre-patch user-visible error:

Pre-patch ExpoQuickActions startup error

For each run, the target APK was installed, the app was force-stopped, app data and logcat were cleared, and the app was sent Home as JavaScript initialized. Android logged currentActivity isn't available in both runs.

Pre-patch APK 26083104 Patched APK 26083116
ExpoQuickActions.setItems rejection 1 0
Caused-by NPE 1 0
contact_support registered before reopen No Yes
do_not_uninstall registered before reopen No Yes
Red alert after reopen Yes No

Pre-patch logcat:

22:06:18.676 RNSentry: currentActivity isn't available.
22:06:18.938 ReactNativeJS: Showing error drop-down alert: Call to function 'ExpoQuickActions.setItems' has been rejected.
22:06:18.938 ReactNativeJS: → Caused by: java.lang.NullPointerException

Patched logcat, captured before returning the app to the foreground:

22:09:32.174 RNSentry: currentActivity isn't available.
22:09:32.242 ReactNativeJS: Running "edge"

The patched log contained zero quick-actions rejection/NPE matches. Before reopening the app, dumpsys shortcut already contained both dynamic records with the same fresh timestamp:

ShortcutInfo {id=contact_support, ... timestamp=1788239372428
ShortcutInfo {id=do_not_uninstall, ... timestamp=1788239372428

The patched lifecycle test was repeated at 50, 100, 150, and 200 ms. Every run logged that the Activity was unavailable, registered both shortcut IDs, and produced zero matching quick-actions errors.

Behavior preserved from #6001

  • titles and subtitles still come from lstrings / Crowdin
  • URLs and availability remain app-configurable for white-label builds
  • setItems still runs on launch, so wording changes and additional actions replace the previous definitions
  • shortcuts remain dynamic rather than duplicated in native resources

Verification

  • controlled pre-patch versus patched device test above
  • long-press menu contains both configured actions after the patched lifecycle test
  • npm run lint — 0 errors (existing warnings only)
  • npx tsc --noEmit
  • npm test — 99 suites, 722 tests, 107 snapshots passed
  • patch applied cleanly to the published expo-quick-actions 5.0.0 package

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Requirements

No intentional visual GUI changes. The quick-action menu remains dynamic and visible; the erroneous startup alert is removed because registration succeeds without a foreground Activity.

@JP0P
JP0P force-pushed the codex/fix-quick-actions-android branch 2 times, most recently from 0460d37 to 5a96011 Compare September 1, 2026 02:17
JP0P added 2 commits August 31, 2026 22:31
Build Android shortcut intents from the package launch intent so
dynamic registration does not depend on a foreground activity. Report
any remaining registration failure without interrupting app startup.
@JP0P
JP0P force-pushed the codex/fix-quick-actions-android branch from 5a96011 to 9759205 Compare September 1, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant