I'm trying to simulate NFC on my Computer with Open-NFC. I managed to install it and it seems to be able to connect with the NFC Controller Simulator. When I simulate a tag, my AVD reacts by opening the web browser or even opening the program that I am developing. The problem is that my program, as well as an open source program from ST-Microelectronics, don't recognize the tag.
Versions:
Android Studio 0.8.6
(Open-NFC)NFC Controller Simulation v 4.5.2
(Open-NFC)Connection Center v4.5.2
(Open-NFC)SDK add-on, 4.4.1 Android 4.0.3
APP M24LR SampleCode form ST-Microelectronics
Settings AVD
NFC enabled
10.0.2.2
NFC Controller simulator
Settings Connection Center
Accept service client connections from other machines
Accept service provider connections from other machines
Accept child Connection Centers
If you need more information please don’t hesitate to ask. I have another add-on version then the Core-Edition from Open-NFC, could that be a problem?
This is part of the code from the demo program:
protected void onCreate(Bundle savedInstanceState) {
// after checking if nfc is enabled...
mPendingIntent = PendingIntent.getActivity(this, 0,new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_TAG_DISCOVERED);
mFilters = new IntentFilter[] {ndef,};
// and then some other stuff...
protected void onNewIntent(Intent intent)
{
// TODO Auto-generated method stub
super.onNewIntent(intent);
String action = intent.getAction();
if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action))
{
Tag tagFromIntent = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
DataDevice dataDevice = (DataDevice)getApplication();
dataDevice.setCurrentTag(tagFromIntent);
byte[] GetSystemInfoAnswer = NFCCommand.SendGetSystemInfoCommandCustom(tagFromIntent,(DataDevice)getApplication());
if(DecodeGetSystemInfoResponse(GetSystemInfoAnswer))
{
Intent intentScan = new Intent(this, Scan.class);
startActivity(intentScan);
}
else
{
return;
}
}
}
protected void onResume()
{
// TODO Auto-generated method stub
super.onResume();
//Used for DEBUG : Log.v("NFCappsActivity.java", "ON RESUME NFC APPS ACTIVITY");
mPendingIntent = PendingIntent.getActivity(this, 0,new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
mAdapter.enableForegroundDispatch(this, mPendingIntent, mFilters, mTechLists);
}