Release Date: [Insert Date, e.g., April 2025]
Imagine reading an NFC tag in just a few lines of code, without worrying about the lifecycle of the Activity or the messy OnNewIntent overrides. Winsoft NFCNet v10 lets you focus on what your app does with the data, rather than how to get the data. winsoft nfcnet library for android v10 new
// Conceptual usage example
public class MainActivity : AppCompatActivity
protected override void OnCreate(Bundle savedInstanceState)
base.OnCreate(savedInstanceState);
// Initialize the library with modern .NET simplicity
var nfc = new NfcNet(this);
nfc.TagDetected += (sender, e) =>
var tag = e.Tag;
var ndef = tag.NdefMessage;
// Handle NDEF data cleanly
RunOnUiThread(() =>
Toast.MakeText(this, $"Read: ndef.GetText()", ToastLength.Short).Show()
);
;
Fix: Use reader.enableDiscoveryWithPrompt() which shows a system dialog asking the user to enable NFC. Release Date: [Insert Date, e
public class NFCScanner
private NFCNetReader reader;
private Activity activity;
public void start(Activity act)
this.activity = act;
reader = NFCNet.getInstance().getReader(act);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
reader.enableForegroundDispatch();
else
reader.enable();
reader.setReaderCallback(new NFCNetReader.ReaderCallback()
@Override
public void onTagDiscovered(TagInfo tagInfo)
String uid = bytesToHex(tagInfo.getUid());
Log.i("NFC", "UID: " + uid);
// Example: read NDEF if present
Ndef ndef = Ndef.get(tagInfo.getTag());
if (ndef != null)
try
ndef.connect();
NdefMessage msg = ndef.getNdefMessage();
// process NDEF
catch (IOException e)
@Override
public void onError(Exception e)
Log.e("NFC", "Error", e);
);
private String bytesToHex(byte[] bytes)
StringBuilder sb = new StringBuilder();
for (byte b : bytes) sb.append(String.format("%02X", b));
return sb.toString();
Release Date: [Insert Date, e.g., April 2025]
Imagine reading an NFC tag in just a few lines of code, without worrying about the lifecycle of the Activity or the messy OnNewIntent overrides. Winsoft NFCNet v10 lets you focus on what your app does with the data, rather than how to get the data.
// Conceptual usage example
public class MainActivity : AppCompatActivity
protected override void OnCreate(Bundle savedInstanceState)
base.OnCreate(savedInstanceState);
// Initialize the library with modern .NET simplicity
var nfc = new NfcNet(this);
nfc.TagDetected += (sender, e) =>
var tag = e.Tag;
var ndef = tag.NdefMessage;
// Handle NDEF data cleanly
RunOnUiThread(() =>
Toast.MakeText(this, $"Read: ndef.GetText()", ToastLength.Short).Show()
);
;
Fix: Use reader.enableDiscoveryWithPrompt() which shows a system dialog asking the user to enable NFC.
public class NFCScanner
private NFCNetReader reader;
private Activity activity;
public void start(Activity act)
this.activity = act;
reader = NFCNet.getInstance().getReader(act);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
reader.enableForegroundDispatch();
else
reader.enable();
reader.setReaderCallback(new NFCNetReader.ReaderCallback()
@Override
public void onTagDiscovered(TagInfo tagInfo)
String uid = bytesToHex(tagInfo.getUid());
Log.i("NFC", "UID: " + uid);
// Example: read NDEF if present
Ndef ndef = Ndef.get(tagInfo.getTag());
if (ndef != null)
try
ndef.connect();
NdefMessage msg = ndef.getNdefMessage();
// process NDEF
catch (IOException e)
@Override
public void onError(Exception e)
Log.e("NFC", "Error", e);
);
private String bytesToHex(byte[] bytes)
StringBuilder sb = new StringBuilder();
for (byte b : bytes) sb.append(String.format("%02X", b));
return sb.toString();