I have an app where a special Activity A is able to transfer data:
When Device1 is in Activity A and you pair it with Device2 (no matter where Device2 is, even if the app is not started) the data is successfully transfferred after the beam touch. Activity A has the intent filter:
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/de.my.app" />
</intent-filter>
on does the necessary push.
But when I am in another activity B, this also makes
- The other device start the app
- Make the touch mode appear on both devices if the app is started. I dont want any device have the change to do the beam now. If you are on the android desktop and you pair the devices, you do not get the beam dialog too. You just get a small vibration. Thats what I want here. Is it possible?
Thanks in advance!
In Activity B, you can turn on foreground-dispatching, ignore any NFC intents and disable sending Android Beam messages:
You could make this a little more specific by filtering only for the
Ndef
technology in thePendingIntent
and/or checking in theonNewIntent()
what other technologies theTag
object supports. Android Beam intents always have theNdef
technology and no other ones.