1

私は2つの異なるアプリ間でNFCを使用してデータを送信するためにAndroidビームを使用しています.別の回答からコードをテストし、パラメータを変更しました.他のデバイスのアプリ。別のアプリを開く必要があります。誰かが私を助けることができますか??

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>
4

0 に答える 0