List of usage examples for android.nfc NdefRecord TNF_EXTERNAL_TYPE
short TNF_EXTERNAL_TYPE
To view the source code for android.nfc NdefRecord TNF_EXTERNAL_TYPE.
Click Source Link
Used to encode custom payloads.
From source file:Main.java
@Deprecated public static NdefRecord createExternal(String domain, String type, byte[] data) { if (domain == null) throw new NullPointerException("domain is null"); if (type == null) throw new NullPointerException("type is null"); domain = domain.trim().toLowerCase(Locale.US); type = type.trim().toLowerCase(Locale.US); if (domain.length() == 0) throw new IllegalArgumentException("domain is empty"); if (type.length() == 0) throw new IllegalArgumentException("type is empty"); byte[] byteDomain = domain.getBytes(Charset.forName("UTF_8")); byte[] byteType = type.getBytes(Charset.forName("UTF_8")); byte[] b = new byte[byteDomain.length + 1 + byteType.length]; System.arraycopy(byteDomain, 0, b, 0, byteDomain.length); b[byteDomain.length] = ':'; System.arraycopy(byteType, 0, b, byteDomain.length + 1, byteType.length); return new NdefRecord(NdefRecord.TNF_EXTERNAL_TYPE, b, new byte[0], data); }