2012-07-04 38 views
2

任何一個可以請告訴我「科學」這個功能「IsoDep.get(標籤)」,而調試

`IsoDep.get(tag)` 

身後,它返回即使標籤被正確讀取返回null。 我在eclipse中運行android應用程序。

+0

你的意思是「在Eclipse中」在Android模擬器? –

+0

andriod設備.. – Ahsan

回答

-1

如果你看一看的documentation:)

  • ,則返回null IsoDep不是在getTechList枚舉(。這 表示標籤不支持ISO-DEP。

它看起來像您正在閱讀的NFC標籤不支持IsoDep。

要了解支持哪些內容,請使用此方法。

private static String debugTag(Tag tag) 
{ 
    String str = "=== DEBUG TAG ==="; 
    for (String techListItem : tag.getTechList()) 
    { 
     str += "\n" + techListItem; 
    } 

    return str; 
} 
+0

或嘗試像[TagInfo](https://play.google.com/store/apps/details?id=com.nxp.taginfolite)這樣的應用程序;這會在最後一個標籤上向您展示Android支持的標籤類。 –

0

執行以下步驟。

1)獲取NFC技術標籤,即使用tag.getTechList()方法不太難找到。

2)假設設備支持像NfcF

3只有一個高科技標籤),然後使用android類的NfcF像下面

NfcF mifare = NfcF.get(tag); 
     try { 
      mifare.connect(); 
      if(mifare.isConnected()){ 
       byte[] historicalData=mifare.getManufacturer(); 
       return new String(historicalData, Charset.forName("US-ASCII")); 
      } 

     } catch (IOException e) { 
      Log.e("Deepak", "IOException while writing MifareUltralight message...", e); 
     } 

希望它會幫助你。 :)

享受編碼...