I am using Apache cordova
to build android applications. I made an application with NFC
feature.
we already written data into NFC tag, with mimetype: myApp/firstNFCApp
. Inside my application whenever detect tag with this mimetype
my application will read data and showing that data into user friendly manner. This way I implemented, it's working fine.This was the code I written to fetch data from tag
nfc.addNdefListener(
function(nfcEvent){
console.log(nfc.bytesToString(nfcEvent.tag.ndefMessage[0].payload));
},
function(){
console.log("sucessfully created");
},
function(){
console.log("something went wrong");
}
);
Now I want to launch my application,whenever device detect a tag with mimetype: myApp/firstNFCApp
. For this, I written following code
<intent-filter>
<data android:mimeType="myApp/firstNFCApp" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
and I added android:noHistory="true"
to activity
element in androidManifest.xml
file.
What I want :
If the device detect any tag with my mimetype,want to launch application also need's to trigger that callback(means,console will print).I am using chariotsolutions/phonegap-nfc
plugin.
This is way, I tried it's not working. can anyone help me thank you.