Cordova NFC plugin not working -


i trying build test cordova application read , write nfc tags targeting windows phones , android phone. when test application deployed devices, on android error message telling “class not found” while trying register listener. on windows phone nothing.

following steps used create application using cordova cli

created cordova application

added platforms

added plugin (https://github.com/chariotsolutions/phonegap-nfc.git)

added following code replacing deviceready in index.js file

    try {         // read ndef formatted nfc tags         nfc.addndeflistener(             function (nfcevent) {                 var tag = nfcevent.tag,                     ndefmessage = tag.ndefmessage;                  // dump raw json of message                 // note: real code need decode                 // payload each record                 alert(json.stringify(ndefmessage));                  // assuming first record in message has                  // payload can converted string.                 alert(nfc.bytestostring(ndefmessage[0].payload).substring(3));             },             function () { // success callback                 alert("waiting ndef tag");             },             function (error) { // error callback                 alert("error adding ndef listener " + json.stringify(error));             }         );     } catch (ex) {         alert(ex.message);     }       app.receivedevent('deviceready');  } 

compressed project folder , uploaded phone-gap-build.

got project build , deployed android , windows 8.1 phones (nfc enabled on both devices). phone-gap build has used phonegap 3.7.0 build application

when tried execute app, while trying register listener, android complained ‘class not found’. windows phone did not throw errors (at least nothing see), not recognizing of nfc cards presented it. under \nfcreaderb\platforms\android\src\com\chariotsolutions\nfc\plugin, can see required java source files android platform

nfc functions on phones working fine

the code available @ https://github.com/cmeegamarachchi/nfc

and on resolving appreciated

the problem using phonegap build didn't configure plugin properly. command line tool used install plugins when building locally. phonegap build, need define plugins in config.xml.

<gap:plugin name="phonegap-nfc" source="npm" /> 

use phonegap command upload project phonegap build servers.

phonegap remote build android 

login http://build.phonegap.com download app phone.

an updated version of code available https://github.com/don/phonegap-nfc-issue-190

for more info on phonegap build plugins see http://docs.build.phonegap.com/en_us/configuring_plugins.md.html#plugins


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -