Question

I have an App that reads NFC Tags. This works fine so far - when the NfcAdapter.ACTION_TAG_DISCOVERED Intent is fired my Activity1 gets started.

Now I have the situation that I have an Activity2 which should read the NFC tag if the Activity2 is on foreground. So I want the Activity2 to listen to the NFC intent and intercept the intent, so that Activity1 doesn't get started - Activity2 already processed the intent.

Currently Activity1 has the NFC intent assigned in the Android Manifest and therefore always receives all NFC off the app.

Background: I have an app that reads NFC Cards from out customers and starts the Customer Details activity. Now I want to have Admin-Cards that should be used as login if privileged function requested. So I would start a "login-NFC-listener" to let the Admin authenticate via Admin-Card. The currenty situation would start the Customer Details activity instead of my login processing every time.

Thank you very much! :)

Was it helpful?

Solution

It's more obvious than i thought: http://developer.android.com/guide/topics/connectivity/nfc/advanced-nfc.html#foreground-dispatch

I think this will be the solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top