plugman create --name ACR-NFC-Reader-PhoneGap-Plugin --plugin_id com.frankgreen --plugin_version 0.0.1
plugman platform add --platform_name android
cordova plugin add https://github.com/ThreeSixtyEu/ACR-NFC-Reader-PhoneGap-Plugin.git
This method will be invoke when Reader ready.
Example
ACR.onReady = function (reader) {
alert("ready " + reader);
}
Registers an event listener for Reader
ACR.addTagIdListener(success,failure);
Parameters
success
: on detect a chip successful;failure
: on detect a chip failure;
Example
ACR.addTagIdListener(
function(result){
alert("UID: " + JSON.stringify(result));
},
function(result){
alert("UID Failure: " + JSON.stringify(result));
}
);
Read data from chip
ACR.readData(block,success,failure);
Parameters
block
: which block you want to read.success
: successful callback;failure
: failure callback;
Example
ACR.readData(4,
function(result){
alert("Data: " + JSON.stringify(result));
},
function(result){
alert("Data Failure: " + JSON.stringify(result));
}
);
write data to chip, maximum 16 character in each block
ACR.writeData(block,data,success,failure);
Parameters
block
: which block you want to write.data
: the data will be write to chip.success
: successful callback;failure
: failure callback;
Example
ACR.writeData(4,
"test",
function(result){
alert("Write Data: " + JSON.stringify(result));
},
function(result){
alert("Write Data Failure: " + JSON.stringify(result));
}
);