android nfc(官方翻译)

  次阅读 来源:互联网(转载协议) 2015-09-28 16:15 我要评论(0)


NFC Basics

There are two major uses cases when working with NDEF data and Android:

Reading NDEF data from an NFC tag

Beaming NDEF messages from one device to another with Android Beam?

The Tag Dispatch System

Parsing the NFC tag and figuring out the MIME type or a URI that identifies the data payload in the tag.


Encapsulating the MIME type or URI and the payload into an intent. These first two steps are described in How NFC tags are mapped to MIME types and URIs.

封装MIME类型或者URI和负载放入intent对象,这两步由 How NFC tags are mapped to MIME types and URIs描述。

Starts an activity based on the intent. This is described in How NFC Tags are Dispatched to Applications.

启动一个activity根据这个intent对象,这部分由How NFC Tags are Dispatched to Applications.描述

How NFC tags are mapped to MIME types and URIs(NFC标签是如何映射到MINE类型和URI的?)

Before you begin writing your NFC applications, it is important to understand the different types of NFC tags, how the tag dispatch system parses NFC tags, and the special work that the tag dispatch system does when it detects

an NDEF message. NFC tags come in a wide array of technologies and can also have data written to them in many different ways. Android has the most support for the NDEF standard, which is defined by the NFC Forum.

在你开始写NFC应用之前,理解不同类型的NFC标签,标签调度系统如何解析NFC标签,当标签调度系统检测到NDEC message所要做的特殊工作,NFC标签来着不同类型的技术,写入标签有不同的方式,Android推荐使用NDEF标准,它是由NFC社区发起的

NDEF data is encapsulated inside a message (NdefMessage) that contains one or more records (NdefRecord). Each NDEF record must be well-formed according to the specification of the type of record that you want to create. Android

also supports other types of tags that do not contain NDEF data, which you can work with by using the classes in the package. To learn more about these technologies, see the Advanced NFC topic. Working with these other types of tags involves

writing your own protocol stack to communicate with the tags, so we recommend using NDEF when possible for ease of development and maximum support for Android-powered devices.

NDEF数据封装在一个由多个NdefRecord组成的NdefMessage中,每一个NDEF记录必须是格式良好的根据你要创建的具体类型,Android也支持其他不包含NDEF数据的类型,你能够使用android.nfc.tech进行工作,为了学习这些技术,请看Advanced NFC topic,操作这些标签会牵涉到你自己的协议栈和标签进行交流,因此为了简化开发和最大化支持android设备,我们建议使用NDEF尽可能。

Note: To download complete NDEF specifications, go to the NFC Forum Specification Download site and see Creating common types of NDEF records for examples of how to construct NDEF records.


Now that you have some background in NFC tags, the following sections describe in more detail how Android handles NDEF formatted tags. When an Android-powered device scans an NFC tag containing NDEF formatted data, it parses

the message and tries to figure out the data's MIME type or identifying URI. To do this, the system reads the first NdefRecord inside the NdefMessage to determine how to interpret the entire NDEF message (an NDEF message can have multiple NDEF records). In

a well-formed NDEF message, the first NdefRecord contains the following fields:



  • teamLab创始人猪子寿之: 抛去衣食住行,我还剩下什么?

    teamLab创始人猪子寿之: 抛去衣食住行,我还剩下什么?

  • Oculus公布原型机,大幅度提升可视角,能实现140°的视场水平


  • 2018深圳国际人工智能展览会 2018 shenzhen International Artif

    2018深圳国际人工智能展览会 2018 shenzhen International Artif

  • Michael I. Jordan带你解读百万奖金ATEC蚂蚁人工智能大赛

    Michael I. Jordan带你解读百万奖金ATEC蚂蚁人工智能大赛



近日,美国软性机器抓手制造商 Soft Robotics 宣布,获得 2000 万美元的融资,本轮投资者包括 Scale Venture Partners,Calibrate Ventures...

据外媒报道,加州车管局发布了《2017自动驾驶脱离报告(California Autonomous Vehicle Disengagement Reports)》,其中谈及了脱离的具体...