7, NFC Technology: Let Android automatically run the program

Source: Internet
Author: User

Two important classes for describing data in ndef format

Ndefmessage: Describes information in the NDEF format Ndefrecord: A piece of information describing Ndef information

Ndefmessage and Ndefrecord are the core classes of Android NFC technology, requiring these two classes for both the read-write ndef format NFC tag and the NDEF format data passed through Android beam technology.

to write data to an NFC tag get Tag Object

Tag tag = Intent.getparcelableextra (Nfcadapter.extra_tag);

Determine the data type of the NFC tag (via the Ndef.get method)

Ndef Ndef = ndef.get (tag);

Write Data

Ndef.writendefmessage (Ndefmessage);

Example: Auto-launch Android app
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.