Code example for Tag

Methods: getId, getTechList

0
    public static int treatAsNewTag(Intent intent, Context context) {
        // Check if Intent has a NFC Tag. 
        if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(intent.getAction())) {
            Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
            mTag = tag;
            mUID = tag.getId();
 
            // Return "1" if device supports Mifare Classic. "0" otherwise. 
            return (Arrays.asList(tag.getTechList()).contains(MifareClassic.class.getName())) ? 1 : 0;
        } 
        return -1; 
    } 
 
    /** 
     * Create a connected {@link MCReader} if there is a present Mifare Classic tag. If there is no Mifare Classic tag a error message will be 
     * displayed to toe user. 
     * 
     * @param context The Context in which the error Toast will be shown. 
     * @return A connected {@link MCReader} or "null" if no tag was present. 
     */ 
    public static MCReader checkForTagAndCreateReader(Context context) {