Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Lukas_B_
Beginner
45 Views

XDK, NFC plugin, functions are not defined

Hello all,
I have a problem with my first simple application in Intel XDK. It is very simple test program for NFC.
For this I have installed the phonegap-nfc plugin.

In index.html file I have only one button which call the javascript function:

<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<style>  
  @-ms-viewport { width: 100vw ; zoom: 100% ; }  @viewport { width: 100vw ; zoom: 100% ; }
        
  @-ms-viewport { user-zoom: fixed ; }           @viewport { user-zoom: fixed ; }
</style>

<script src="cordova.js"></script>          
<script src="js/app.js"></script>           
<script src="xdk/init-dev.js"></script>    
</head>

<body>
<form>
<p>Unicate App</p>
 
<input type="submit" value="Write" onClick="writeNDEF">
</form>
</body>

</html>

In the app.js file is also very simply functions which prepare the message "unicate test" and the write it:

function onAppReady()
{
    if( navigator.splashscreen && navigator.splashscreen.hide ) {   // Cordova API detected
 
       navigator.splashscreen.hide() ;
       }}

document.addEventListener("app.Ready", onAppReady, false) ;

function onSuccess() {

    window.alert("Send success"); }

function onFailure() {

    window.alert("Send errors");  }

function writeNDEF() {

var message = [
    ndef.textRecord("Unicate test")
   ];

nfc.write(message, [onSuccess], [onFailure]);    

}

The problem is that there is a error message "ndef is not defined (w117)" and "nfc is not defined".
Can you tell me why it not connected to the plugin phonegap-nfc?

Do you have any idea what I am doing wrong?

Thank you very much for your help.

BR Lukas

 

xdk.png

Tags (2)
0 Kudos
1 Reply
PaulF_IntelCorp
Employee
45 Views

Those are JS Hint problems you are seeing. See the "Blank Cordova Starter App" and the "Hello Cordova App" in the "samples and demos" section of "start a new project" for an example of how to deal with JS Hint errors and how to build a simple Cordova app. Also, see the JS Hint documentation > http://jshint.com/docs/ <

Reply