NFC p2p tag interception

  • Replies:0
Thomas Grimmeissen
  • Forum posts: 1

May 12, 2015, 11:35:51 AM via Website

Hello.

I am building an Android app using Eclipse and the Android SDK. I would like to implement an NFC p2p function in my app in the sense that when you place the 2 phones back to back, both send a string and receive a string automatically. This would of course happen in a separate activity. I have managed to send a custom tag (String) but have been unable to intercept it and use it afterwards in the app code. How can i do this?

This is what i have so far.

public class MainActivity extends Activity {

publicNfcAdapter mAdapter;PendingIntent mPendingIntent;

@override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

mAdapter =NfcAdapter.getDefaultAdapter(this);

NdefRecord rec =NdefRecord.createUri("www.google.com");NdefMessage =newNdefMessage(rec);

mAdapter.setNdefPushMessage(ndef,this);
}

I have spent a lot of time trying to find and understand solutions to intercept the tag. Unsuccessfully.

Thanks for your help.

Thomas

Reply