From fa98cf0573b813c8b1a880496d847d0d7183d05d Mon Sep 17 00:00:00 2001 From: Martijn Coenen Date: Mon, 2 Apr 2012 15:56:07 -0700 Subject: Add API for querying extended length APDU support. Bug: 5813943 Change-Id: Iffb415f318e095bde9ed6677b22613d210f8a39c --- core/java/android/nfc/tech/IsoDep.java | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'core/java/android/nfc/tech') diff --git a/core/java/android/nfc/tech/IsoDep.java b/core/java/android/nfc/tech/IsoDep.java index 1859877..089b159 100644 --- a/core/java/android/nfc/tech/IsoDep.java +++ b/core/java/android/nfc/tech/IsoDep.java @@ -179,4 +179,27 @@ public final class IsoDep extends BasicTagTechnology { public int getMaxTransceiveLength() { return getMaxTransceiveLengthInternal(); } + + /** + *

Standard APDUs have a 1-byte length field, allowing a maximum of + * 255 payload bytes, which results in a maximum APDU length of 261 bytes. + * + *

Extended length APDUs have a 3-byte length field, allowing 65535 + * payload bytes. + * + *

Some NFC adapters, like the one used in the Nexus S and the Galaxy Nexus + * do not support extended length APDUs. They are expected to be well-supported + * in the future though. Use this method to check for extended length APDU + * support. + * + * @return whether the NFC adapter on this device supports extended length APDUs. + */ + public boolean isExtendedLengthApduSupported() { + try { + return mTag.getTagService().getExtendedLengthApdusSupported(); + } catch (RemoteException e) { + Log.e(TAG, "NFC service dead", e); + return false; + } + } } -- cgit v1.1