xding
xding

Reputation: 1

How to make enableForegroundDispatch enabled to whole application, not only to an activity?

I am writing a NFC application. I use the NfcAdapter.enableForegroundDispatch in an activity to make sure a NFC tag detected event routing to this activity direct, not show other applications which has capability to resolve this event. My question is when my application is running, how to make sure the tag detected event routing this activity direct even though this activity is inactive, because the application has three activities.

Upvotes: 0

Views: 890

Answers (1)

NFC guy
NFC guy

Reputation: 10228

You can set up NfcAdapter.enableForegroundDispatch() on the other 2 activities, too. Whenever you receive an NFC intent, you just forward it to the one activity that should handle it.

Upvotes: 1

Related Questions