-1
我目前正試圖攔截Android設備上的所有NFC通信。我曾嘗試使用IntentFilters和TechList的前臺調度將爲null,但是當圖片正在被傳送時,我的應用程序處於前景中時,我不會攔截它。然而像聯繫人這樣的東西被攔截。攔截Android上的所有NFC標籤
有誰知道如何截取像圖片這樣的東西,以便我總是抓住所有發送到手機的物品?我甚至不關心這幅畫,我只關心它的標籤。
謝謝你的幫助。
我目前正試圖攔截Android設備上的所有NFC通信。我曾嘗試使用IntentFilters和TechList的前臺調度將爲null,但是當圖片正在被傳送時,我的應用程序處於前景中時,我不會攔截它。然而像聯繫人這樣的東西被攔截。攔截Android上的所有NFC標籤
有誰知道如何截取像圖片這樣的東西,以便我總是抓住所有發送到手機的物品?我甚至不關心這幅畫,我只關心它的標籤。
謝謝你的幫助。
您的#enableForegroundDispatch方法是這樣的嗎?
protected final void enableNfcEventDiscover() {
final Intent intent = new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
final PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
if (nfcAdapter == null) {
throw new IllegalStateException(
"Cannot enable discover nfc events, you need set the NfcAdapter first");
} else {
nfcAdapter.enableForegroundDispatch(this, pendingIntent, null, null);
}
}
請給我們看一些源代碼。 –
@NFCguy嗨,對不起,有點不好意思,但你似乎已經回答了很多有關NFC的問題。你可以看看下面的內容。 http://stackoverflow.com/questions/28860223/how-to-intercept-nfc-tag-before-onnewintent-executes – turtleboy