Skip to content

feat: set preferred HCE service while app is active#193

Merged
a1denvalu3 merged 1 commit intomainfrom
set-preferred-service
Feb 28, 2026
Merged

feat: set preferred HCE service while app is active#193
a1denvalu3 merged 1 commit intomainfrom
set-preferred-service

Conversation

@a1denvalu3
Copy link
Copy Markdown
Collaborator

@a1denvalu3 a1denvalu3 commented Feb 28, 2026

Summary

This PR uses Android's CardEmulation.setPreferredService to request exclusive ownership of the HCE stack while the app is actively used by the user.

  • ModernPOSActivity & PaymentRequestActivity: Modifies the onResume() and onPause() lifecycle methods.
  • onResume(): Calls setPreferredService to route all NFC taps exclusively to Numo when the app is in the foreground, bypassing the Android OS default wallet disambiguation.
  • onPause(): Calls unsetPreferredService to release the lock, ensuring the user's default wallet settings return to normal when they background or close the app.

This change temporarily acquires exclusive HCE ownership in onResume() and releases it in onPause() for both ModernPOSActivity and PaymentRequestActivity. This ensures NFC taps are reliably routed to Numo while it is open, without permanently overriding the user's default wallet preferences.
@github-project-automation github-project-automation bot moved this to Backlog in Numo Feb 28, 2026
@a1denvalu3 a1denvalu3 merged commit 3bc8be9 into main Feb 28, 2026
3 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Numo Feb 28, 2026
@a1denvalu3 a1denvalu3 deleted the set-preferred-service branch February 28, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant