我正在使用 android beam 在两个不同的应用程序之间使用 NFC 发送数据,我已经测试了来自不同答案的代码,我已经更改了参数等,我总是得到相同的结果:另一个设备打开或尝试打开相同的其他设备中的应用程序。我需要打开一个不同的应用程序。有人能帮我吗??
1) 发件人申请
public NdefMessage createNdefMessage(NfcEvent event) {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
String currentDate= sdf.format(new Date());
NdefMessage msg = new NdefMessage(NdefRecord.createMime("application/com.myapp", currentDate.getBytes()) );
return msg;
}
2) 收到的申请
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="application/com.myapp" />
</intent-filter>