kinghomer
kinghomer

Reputation: 3161

Android: NFC foreground dispatch priority

I hope someone can help me!

I have 2 activity A and B.

In the manifest i specified activity A as handler of NFC event

<intent-filter>
            <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <data android:mimeType="text/plain" />
</intent-filter>

and in B i defined foreground dispatch for handling something different with Tag Payload (that's a simple plain/text).

Now...

the problem is when i enable foregroundDispatch in B activity. When it happens, every time i put phone on tag, in any situation, B activity is called! I don't want this. I expect that happens ONLY if B is foreground and, if not, A activity is called!

It works only at first time, when B activity has not enabled foreground dispatch in onResume. How can i do ?

I hope my bad english is enough for explaining all well

Thx in advance

Upvotes: 0

Views: 812

Answers (1)

NFC guy
NFC guy

Reputation: 10228

Did you call disableForegroundDispatch() in onPause() of Activity B?

Upvotes: 1

Related Questions