我正在使用 2 Galaxy S3,我从一个发送消息到另一个。我希望对方发回类似“received msg”之类的响应,我正在使用 android Beam 演示,并且我想添加这个 ack。当我用简单的“sendNdefMessage”处理 ProcessIntent 中的第一条消息时,我发送 ack 消息? 我如何管理在其他设备中收到的 ack?
void processIntent(Intent intent) {
Parcelable[] rawMsgs = intent.getParcelableArrayExtra(
NfcAdapter.EXTRA_NDEF_MESSAGES);
// only one message sent during the beam
NdefMessage msg = (NdefMessage) rawMsgs[0];
// record 0 contains the MIME type, record 1 is the AAR, if present
mInfoText.setText(new String(msg.getRecords()[0].getPayload()));
//ack message
mNfcAdapter.setNdefPushMessageCallback(ackMsg, this);
}
非常感谢