Code example for NdefRecord

Methods: getTnf, getType

0
            Log.w(TAG, "No records " + intent);
            finish();
        } 
 
        NdefRecord record = records[0];
        String type = new String(record.getType(), Charset.forName("UTF8"));
        if (record.getTnf() != NdefRecord.TNF_MIME_MEDIA ||
                (!"text/x-vcard".equalsIgnoreCase(type) && !"text/vcard".equals(type))) {
            Log.w(TAG, "Not a vcard");
            //setStatus(getString(R.string.fail_reason_not_supported)); 
            return; 
        } 
        mRecord = record;
 
        final AccountTypeManager accountTypes = AccountTypeManager.getInstance(this);
        final List<AccountWithDataSet> accountList = accountTypes.getAccounts(true);
        if (accountList.size() == 0) {
            mAccount = null;
        } else if (accountList.size() == 1) {
            mAccount = accountList.get(0);
        } else {