Skip to content

Commit 40ddd4a

Browse files
Nick PellyAndroid (Google) Code Review
authored andcommitted
Merge "Implemented getSize() to return max ndef size." into gingerbread
2 parents 5289b91 + 6d9fc7e commit 40ddd4a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,22 @@ public final class Ndef extends BasicTagTechnology {
4747
/** @hide */
4848
public static final String EXTRA_NDEF_MSG = "ndefmsg";
4949

50+
/** @hide */
51+
public static final String EXTRA_NDEF_MAXLENGTH = "ndefmaxlength";
52+
53+
private final int maxNdefSize;
54+
5055
/**
5156
* Internal constructor, to be used by NfcAdapter
5257
* @hide
5358
*/
5459
public Ndef(NfcAdapter adapter, Tag tag, int tech, Bundle extras) throws RemoteException {
5560
super(adapter, tag, tech);
61+
if (extras != null) {
62+
maxNdefSize = extras.getInt(EXTRA_NDEF_MAXLENGTH);
63+
} else {
64+
maxNdefSize = 0; //TODO: throw exception
65+
}
5666
}
5767

5868
/**
@@ -95,7 +105,7 @@ public NdefMessage[] getExtraNdefMessage() throws IOException, FormatException {
95105
* Get maximum NDEF message size in bytes
96106
*/
97107
public int getSize() {
98-
throw new UnsupportedOperationException();
108+
return maxNdefSize;
99109
}
100110

101111
/**

0 commit comments

Comments
 (0)