gatzkerob
gatzkerob

Reputation: 899

Android - Prevent other apps from reading NFC when current app in foreground

I created an NFC app. I designed it so only one of its activities can process an NFC tag. When another activity is active (same app), and the tag is scanned, another app steals focus and sends my app to the background. How can I prevent all other NFC apps from stealing focus while my app is running in foreground?

Upvotes: 0

Views: 2631

Answers (1)

Nikolay Elenkov
Nikolay Elenkov

Reputation: 52936

You can't really. Your only option is to have all your activities use foreground dispatch to make sure your app handles the tag if it is visible. You can probably use a base activity to share the code.

Upvotes: 3

Related Questions