我的工作中,我創建一個本地.csv文件的一個項目,我想使用NFC來發送該文件。如何發送使用NFC文件中的Android觸摸模式
到目前爲止,這是我在我的活動代碼。
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(this);
if (nfcAdapter == null) {
return; // NFC not available on this device
}
Uri uri1;
File root ;
root= Environment.getExternalStorageDirectory();
//assign the file path to the uri
uri1=Uri.fromFile(new File(root, "myFile.csv"));
nfcAdapter.setBeamPushUris(new Uri[] {uri1}, this);
}
不幸的是我目前沒有其他設備來檢查它,但我會在不久的將來這樣做。我的問題是,如果兩個設備在一起時我怎麼能將文件發送到其他設備?通常android有這些功能的監聽器。 NFC有什麼相似之處嗎?
我測試4.2.2應用在Nexus 4