private void MessageReceived(ProximityDevice sender, ProximityMessage message) { NdefMessage ndefMessage = new NdefMessage(); ndefMessage.AddRecord(new NdefRecord { Data = message.Data.ToArray(), RecordType = message.MessageType }); }
public override void DidDetect(NFCNdefReaderSession session, NFCNdefMessage[] messages) { foreach (var message in messages) { NdefMessage newMessage = new NdefMessage(); foreach (var record in message.Records) { var parsedRecord = ParseNdefRecord(record); newMessage.AddRecord(parsedRecord); } reader.Reading?.Invoke(this, newMessage); } }
private void Reader_Reading(object sender, InTheHand.Nfc.NdefMessage e) { Device.BeginInvokeOnMainThread(() => { foreach (var record in e.Records) { if (record.RecordType == NdefRecordType.Mime) { DisplayAlert("NDEF", $"{record.MediaType} {((byte[])record.Data).Length}", "OK"); } else { DisplayAlert("NDEF", $"{record.RecordType} {record.Data}", "OK"); } } }); }