IT. Expert System.

Android Reference

NdefFormatable


android.nfc.tech

Class NdefFormatable

  • All Implemented Interfaces:
    TagTechnology, Closeable, AutoCloseable


    public final class NdefFormatable
    extends Object
    Provide access to NDEF format operations on a Tag.

    Acquire a NdefFormatable object using get(android.nfc.Tag).

    Android devices with NFC must only enumerate and implement this class for tags for which it can format to NDEF.

    Unfortunately the procedures to convert unformated tags to NDEF formatted tags are not specified by NFC Forum, and are not generally well-known. So there is no mandatory set of tags for which all Android devices with NFC must support NdefFormatable.

    Note: Methods that perform I/O operations require the android.Manifest.permission#NFC permission.

    • Method Detail

      • get

        public static NdefFormatable get(Tag tag)
        Get an instance of NdefFormatable for the given tag.

        Does not cause any RF activity and does not block.

        Returns null if NdefFormatable was not enumerated in Tag.getTechList(). This indicates the tag is not NDEF formatable by this Android device.

        Parameters:
        tag - an NDEF formatable tag
        Returns:
        NDEF formatable object
      • format

        public void format(NdefMessage firstMessage)
                    throws IOException,
                           FormatException
        Format a tag as NDEF, and write a NdefMessage.

        This is a multi-step process, an IOException is thrown if any one step fails.

        The card is left in a read-write state after this operation.

        This is an I/O operation and will block until complete. It must not be called from the main application thread. A blocked call will be canceled with IOException if close() is called from another thread.

        Requires the android.Manifest.permission#NFC permission.

        Parameters:
        firstMessage - the NDEF message to write after formatting, can be null
        Throws:
        TagLostException - if the tag leaves the field
        IOException - if there is an I/O failure, or the operation is canceled
        FormatException - if the NDEF Message to write is malformed
      • formatReadOnly

        public void formatReadOnly(NdefMessage firstMessage)
                            throws IOException,
                                   FormatException
        Formats a tag as NDEF, write a NdefMessage, and make read-only.

        This is a multi-step process, an IOException is thrown if any one step fails.

        The card is left in a read-only state if this method returns successfully.

        This is an I/O operation and will block until complete. It must not be called from the main application thread. A blocked call will be canceled with IOException if close() is called from another thread.

        Requires the android.Manifest.permission#NFC permission.

        Parameters:
        firstMessage - the NDEF message to write after formatting
        Throws:
        TagLostException - if the tag leaves the field
        IOException - if there is an I/O failure, or the operation is canceled
        FormatException - if the NDEF Message to write is malformed
      • isConnected

        public boolean isConnected()
        Description copied from interface: TagTechnology
        Helper to indicate if I/O operations should be possible.

        Returns true if TagTechnology.connect() has completed, and TagTechnology.close() has not been called, and the Tag is not known to be out of range.

        Does not cause RF activity, and does not block.

        Specified by:
        isConnected in interface TagTechnology
        Returns:
        true if I/O operations should be possible


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 752 / 248551123. Delta: 0.02981 с