添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
坚强的南瓜  ·  利用 pandas 和 xarray ...·  2 年前    · 
爱旅游的帽子  ·  python - Why is 'key' ...·  2 年前    · 
风流的冰淇淋  ·  20 ...·  2 年前    · 

[assembly:UsesPermission(Manifest.Permission.Nfc)]
[assembly:UsesFeature(PackageManager.FeatureNfc,Required =true)]
namespace NFCReader
[Activity(Label = "NFCReader", MainLauncher = true,LaunchMode =LaunchMode.SingleTop)]
public class MainActivity : Activity
private TextView textView;
private NfcAdapter nfcAdapter;
protected override void OnCreate(Bundle savedInstanceState)
base.OnCreate(savedInstanceState);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
textView = FindViewById<TextView>(Resource.Id.ReadInfo);
protected override void OnResume()
base.OnResume();
//获取默认NFC控制器
nfcAdapter = NfcAdapter.GetDefaultAdapter(this);
if (nfcAdapter==null) {
textView.Text += string.Format("NFC not support on this devices.\n");
return;
//判断设备是否支持NFC
if (!nfcAdapter.IsEnabled) {
textView.Text += string.Format("NFC is not enabled.\n");
return;
textView.Text += string.Format("Hold the tag against the phone to begin reading...\n");
//当NFC标签被发现时创建过滤器
var tagDetected = new IntentFilter(NfcAdapter.ActionTagDiscovered);
var filters = new[]{tagDetected };
//当检测到NFC标签时,PendingIntent用来返回这个Activity
var intent = new Intent(this,GetType());
var pendingIntent = PendingIntent.GetActivity(this,0,intent,0);
//使用前台系统发布
nfcAdapter.EnableForegroundDispatch(this,pendingIntent,filters,null);
protected override void OnPause()
base.OnPause();
//取消前台系统发布
if (nfcAdapter!=null) {
nfcAdapter.DisableForegroundDispatch(this);
protected override void OnNewIntent(Intent intent)
textView.Text += string.Format("Possible NFC tag detected:'{0}'.\n",intent.Action);
//获得标签
var tag = intent.GetParcelableExtra(NfcAdapter.ExtraTag) as Tag;
if (tag!=null) {
textView.Text += string.Format("NFC tag detected:\n");
textView.Text += string.Format("Tag ID :'{0}'\n",Encoding.UTF8.GetString(tag.GetId()));
textView.Text += string.Format("Tech List:\n");
foreach (var tech in tag.GetTechList()) {
textView.Text += string.Format("Tech:'{0}'",tech);
//获取信息
var ndefMessages = intent.GetParcelableArrayExtra(NfcAdapter.ExtraNdefMessages);
if (ndefMessages!=null) {
textView.Text += string.Format("NFC NDEF message detected:\n");
//获得在标签中的每一条信息
foreach (var message in ndefMessages.Cast<NdefMessage>()) {
textView.Text += string.Format("Message:{0}\n",message.GetType().FullName);
foreach (var record in message.GetRecords()) {
textView.Text += string.Format("Record:{0}\n",record.GetType().FullName);
textView.Text += string.Format("ID:{0}\n",Encoding.UTF8.GetString(record.GetId()));
textView.Text += string.Format("Type Info:{0}\n",Encoding.UTF8.GetString(record.GetTypeInfo()));
var payload = record.GetPayload();
textView.Text += string.Format("Payload:{0}\n",Encoding.UTF8.GetString(payload)); using Android.App;using Android.Widget;using Android.OS;using Android;using Android.Content.PM;using Android.Nfc;using Android.Content;using System.Text;using System.Linq;[assembly:UsesPermission(Mani...
详尽kmpby Jose Berardo Cunha 由Jose Berardo Cunha设计 关于移动开发体系结构的详尽而详尽的指南 (A deeply detailed but never definitive guide to mobile development architecture) Native, Web, PWA, hybrid, Cross-Compiled… what ...
插件 NFC 一个跨平台 NFC (近场通信)插件,可轻松在您的应用程序中读写 NFC 标签。 该插件使用NDEF ( NFC 数据交换格式)来最大程度地在 NFC 设备,标签类型和操作系统之间实现兼容性。 NuGet 我的Get 插件 NFC CI订阅源: : Google Nexus 5,华为Mate 10 Pro iPhone 7 当前不支持Windows。 拉请求是受欢迎的! 特定于 Android Android Manifest.xml添加 NFC 权限 android .permission.NF
Android NFC 开发-理论篇中,我们了解了在 Android 中开发 NFC 的一些理论知识,这篇我们继续应用我们上一篇学到的知识,实现对NDEF格式标签和MifareClassic格式标签的读写操作。基本操作配置 Android Menifest.xml:<!--API level 9只包含有限的tag支持,包括: .通过ACTION_TAG_DISCOVERED来发布Tag信息 什么是 Xamarin ? Xamarin 始创于2011年,旨在使移动开发变得难以置信地迅捷和简单。 Xamarin 的产品简化了针对多种平台的应用开发,包括iOS、 Android 、Windows Phone和Mac App。 Xamarin 由许多著名的开源社区开发者创立和参与,而且也是Mono项目的主导者——C#与·NET框架的...