在没有特定应用程序的情况下读取 NFC 标签? [英] Read NFC tag without specific application?

查看:25
本文介绍了在没有特定应用程序的情况下读取 NFC 标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有任何方法可以将文本字符串 (URL) 保存到 NFC 标签,比如 MIFARE 或 NTAG203,无需任何特殊标签读取即可被其他设备(智能手机)读取应用.

I was wondering if there is any way to save a string of text (URL) to an NFC tag, let us say MIFARE or NTAG203, that can be read by other devices (smartphones) without the need of any special tag reading application.

我已经测试了几个应用程序,例如触发 Android,并注意到如果读取标签的设备没有所需的应用程序来读取标签上的数据/指令,它仍然会打开一个 URL,将您发送到 Play 商店以下载该应用程序.

I have tested several applications, e.g. Trigger for Android, and noticed that if the device reading the tag does not have the required application to read the data/instructions off the tag it still opens a URL that sends you to the Play Store to download that application.

因此,必须有一种方法可以保存所有/某些支持 NFC 的手机可以读取的一些数据.简而言之,我想为 Android 创建一个应用程序,它将数据写入 NFC 标签,并且可以通过随机启用 NFC 的手机读取/打开/执行数据.

So there must be a way to save some data readable by all/some NFC enabled phones. Simply put I want to create an applcation for Android that will write data to NFC tags and the data can be read/opened/executed by a random NFC enabled phone.

那么是否有可能准备一个 NFC 标签来触发读取设备上的某些操作而不需要特定的应用程序?我可以用我的应用在 NFC 标签上写入什么类型的数据来实现这一点?

So is it possible to prepare an NFC tag that triggers some action on the reading device without requiring a specific application? What type of data could I write on an NFC tag with my app to achieve this?

推荐答案

首先,总的来说,我同意 CommonsWare 的观点,即它始终是处理 NFC 事件的特殊"应用程序.但是,在研究 Android 时,我会将 AOSP 的各种平台应用程序视为 Android 系统的一部分.即使并非所有设备都可以在所有设备上使用.

First of all, in general, I agree with CommonsWare point of view that it's always a "special" app that handles NFC events. However, when looking into Android, I would consider the various platform apps from AOSP as part of the Android system. Even though not all of them may be available on all devices.

查看 Andrid 4.4+,以下数据类型由此类系统应用处理:

Looking into Andrid 4.4+, the following data types are handled by such system apps:

  • 浏览器:具有http:"和https:"方案的 URI.
  • 联系人和拨号器:MIME 类型text/vcard"和text/x-vcard"用于导入联系人.
  • 电子邮件:具有方案mailto:"的 URIs

此外,如果没有其他应用程序处理某个标签,NFC 设备应该(?)有标签应用程序,它会尝试处理各种类型(在用户确认后):

In addition, if no other app handles a certain tag, NFC devices should(?) have the Tag app, that tries to handle various types (upon user confirmation):

  • 方案为tel"的 URI 将导致 ACTION_CALL 意图呼叫给定号码.
  • 具有sms"/smsto"方案的 URI 将导致 ACTION_SENDTO 意图开始编辑 SMS 消息.
  • 其他 URI 应该(?)在 ACTION_VIEW 意图中转发.
  • 类型为text/x-vcard"(如果尚未处理)的 MIME 类型记录应在 ACTION_VIEW 意图中转发.
  • 文本 RTD 记录(不是文本/* MIME 类型!)的文本消息应显示在标签应用程序中.不幸的是,许多愚蠢的(!)NFC 应用程序注册了文本记录,因此您通常不会访问标签应用程序.
  • 类型为 image/* 的 MIME 类型记录(如果 Android 支持图像类型)应显示在 Tag 应用中.

一些记录由 NFC 服务本身处理(这在 Android 上应该始终可用):

Some records are handled by the NFC service itself (this should always be available on Android):

  • Android 应用程序记录(类型名称为urn:nfc:ext:android.com:pkg"的 NFC 论坛外部类型)导致带有 URImarket://details?id={PACKAGE_NAME}"的 ACTION_VIEW Intent 为已发送.
  • 解析类型名称为urn:nfc:nokia.com:bt"的 NFC 论坛外部类型以进行蓝牙连接切换.
  • 解析以 Handover Select RTD 记录开头并包含application/vnd.bluetooth.ep.oob"类型的 MIME 类型记录的 NDEF 消息以进行蓝牙连接切换.

这篇关于在没有特定应用程序的情况下读取 NFC 标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆