Code example for NdefRecord

Methods: getTnf, getType

0
	public NdefBluetoothPushHandover(NdefExchangeContract ndefExchange) {
		mmBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
		mNdefExchange = ndefExchange;
	} 
 
	@Override 
	public boolean supportsRequest(NdefRecord handoverRequest) {
	    short tnf = handoverRequest.getTnf();
		if (tnf != NdefRecord.TNF_ABSOLUTE_URI && (tnf != NdefRecord.TNF_WELL_KNOWN &&
		        !Arrays.equals(handoverRequest.getType(), NdefRecord.RTD_URI))) {
			return false; 
		} 
		Uri uri;
		try { 
		    uri= NdefFactory.parseUri(handoverRequest);
		} catch (FormatException e) {
		    return false; 
		} 
		String scheme = uri.getScheme();
		return (scheme != null && scheme.equals("ndef+bluetooth"));
	}