[MOD-2651] Unable to get text from NFC
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 2.2.0 |
Fix Version/s | n/a |
Components | NFC |
Labels | n/a |
Reporter | Abir Mukherjee |
Assignee | Satinder Pal Singh |
Created | 2020-06-24T05:48:20.000+0000 |
Updated | 2020-06-24T05:48:22.000+0000 |
Description
User from Axway community unable to get text from NFC device. Additional detail as follows:
The code attempted:
var nfc = require('ti.nfc');
var nfcAdapter = nfc.createNfcAdapter({
onNdefDiscovered : handleDiscovery
});
function handleDiscovery(e) {
// Add rows for the message, tag, and each of the records
var data = [];
Ti.API.warn(e);
if (e.messages) {
var message = e.messages[0];
if (message.records) {
for (var i = 0; i < message.records.length; i++) {
data.push(message.records[i]);
}
}
}
Ti.API.info(data);
}
var win = Ti.UI.createWindow({
backgroundColor : '#fff'
});
var btn = Ti.UI.createButton({
title : 'Start Search'
});
btn.addEventListener('click', function() {
if (!nfcAdapter.isEnabled()) {
Ti.API.error('This device does not support NFC capabilities!');
return;
}
nfcAdapter.begin();
// This is required for iOS only. Use "invalidate()" to invalidate a session.
});
win.add(btn);
win.open();
This is the resulting output:
{ messages = (
{
}
);
}
No comments