Skip to content

Commit 163bd40

Browse files
Nick PellyAndroid (Google) Code Review
authored andcommitted
Merge "Added getType() to NDEF technology class (API part)." into gingerbread
2 parents 8c09ef9 + d27ebf1 commit 163bd40

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

core/java/android/nfc/technology/Ndef.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,20 @@ public final class Ndef extends BasicTagTechnology {
5454
/** @hide */
5555
public static final String EXTRA_NDEF_CARDSTATE = "ndefcardstate";
5656

57+
/** @hide */
58+
public static final String EXTRA_NDEF_TYPE = "ndeftype";
59+
60+
public static final int UNKNOWN_TAG = 0;
61+
public static final int TYPE1_TAG = 1;
62+
public static final int TYPE2_TAG = 2;
63+
public static final int TYPE3_TAG = 3;
64+
public static final int TYPE4_TAG = 4;
65+
public static final int MIFARE_CLASSIC_TAG = 5;
66+
5767
private final int mMaxNdefSize;
5868
private final int mCardState;
5969
private final NdefMessage mNdefMsg;
70+
private final int mNdefType;
6071

6172
/**
6273
* Internal constructor, to be used by NfcAdapter
@@ -68,6 +79,7 @@ public Ndef(NfcAdapter adapter, Tag tag, int tech, Bundle extras) throws RemoteE
6879
mMaxNdefSize = extras.getInt(EXTRA_NDEF_MAXLENGTH);
6980
mCardState = extras.getInt(EXTRA_NDEF_CARDSTATE);
7081
mNdefMsg = extras.getParcelable(EXTRA_NDEF_MSG);
82+
mNdefType = extras.getInt(EXTRA_NDEF_TYPE);
7183
} else {
7284
throw new NullPointerException("NDEF tech extras are null.");
7385
}
@@ -91,6 +103,13 @@ public NdefMessage[] getExtraNdefMessage() throws IOException, FormatException {
91103
throw new UnsupportedOperationException();
92104
}
93105

106+
/**
107+
* Get NDEF card type
108+
*/
109+
public int getType() {
110+
return mNdefType;
111+
}
112+
94113
/**
95114
* Get maximum NDEF message size in bytes
96115
*/

0 commit comments

Comments
 (0)