Cordova – Can I read the NFC tag Uid via PhoneGAP? how about it?

I want to read the UID of an NFC tag. The tag does not have any ndef messages or anything (empty), just the UID. It is easy to do on Android, but Phonegap development is faster, So I want to know if it is possible to use Phonegap, possibly using the phonegap-nfc plugin.
phonagap-nfc plugin will allow you to read Take the UID of the tag.

If you need the tag id, nfc.addTagDiscoveredListener() is good. Starting from phonegap-nfc-0.4.0, the tag ID is also included when the NDEF listener is available Inside.

You can convert id to hexadecimal string to display with nfc.bytesToHexString(tag.id)

function ready() {

function onNfc(nfcEvent) {

var tag = nfcEvent.tag;
var tagId = nfc.bytesToHexString(tag.id);< br /> alert(tagId);

}

function win() {
console.log("Listening for NFC Tags");
}

function fail(error) {
alert("Error adding NFC listener");
}


nfc.addTagDiscoveredListener( onNfc, win, fail);
}

function init() {
document.addEventListener('deviceready', ready, false);
}

I want to read the UID of an NFC tag, the tag does not have any ndef message or anything (empty), just the UID. It is easy to do on Android, but Phonegap development is faster, So I want to know if it is possible to use Phonegap, possibly using the phonegap-nfc plugin.

The phonagap-nfc plugin will allow you to read the UID of the tag.

If you need the tag ID, nfc.addTagDiscoveredListener() is good. Starting from phonegap-nfc-0.4.0, the tag ID is also included when the NDEF listener is available.

You can Convert id to hexadecimal string to display with nfc.bytesToHexString(tag.id)

function ready() {

function onNfc(nfcEvent) {

var tag = nfcEvent.tag;
var tagId = nfc.bytesToHexString(tag.id);
alert(tagId);

}

function win() {
console.log("Listening for NFC Tags");
}

function fail( error) {
alert("Error adding NFC listener");
}


nfc.addTagDiscoveredListener(onNfc, win, fail);
}

function init() {
document.addEventListener('deviceready', ready, false);
}

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3757 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.