Titanium JIRA Archive
Appcelerator Modules (MOD)

[MOD-2651] Unable to get text from NFC

GitHub Issuen/a
TypeBug
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 2.2.0
Fix Version/sn/a
ComponentsNFC
Labelsn/a
ReporterAbir Mukherjee
AssigneeSatinder Pal Singh
Created2020-06-24T05:48:20.000+0000
Updated2020-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 = (
      {
      }
   );
}

Comments

No comments

JSON Source