Reputation: 5264
I am writing an application for read the mifare card from my native android application.For this purpose I am using phonegap 1.9.0.
I have added the phonegap-nfc plugins.
<script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"></script>
<script type="text/javascript" charset="utf-8" src="phonegap-nfc.js"></script>
<script type="text/javascript" charset="utf-8">
function onLoad()
{
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady()
{
// Here I want to write my code for tag listener.
}
Now In phonegap blog,they are discussing about adding a nfc tag listener.
But it is not fully clear.So please tell me how to add event listener in my code.
Upvotes: 0
Views: 2169
Reputation: 23273
It's all right there in the blog post. For example:
nfc.addNdefListener(
function() {
document.write("Found an NDEF formatted tag");
},
function() {
console.log("Success.");
},
function() {
console.log("Fail.");
}
Upvotes: 1