Sélectionnez votre langue

Welcome on NFC Tools API.

Intent Run a profile - NFC Tools PRO only


You want to launch a task profile from your own app ?

1 - Select a task profile and recover the profile name

/**
 * Handle button click
 */
public void onButtonClick(View v) { 
     Intent intent = new Intent();
     intent.setAction("com.wakdev.nfctools.pro.action.CHOOSE_PROFILE");
     startActivityForResult(intent,0);
}

/**
 * On Activity Result
 */
@Override
public void onActivityResult(int requestCode,int resultCode,Intent data){
     super.onActivityResult(requestCode, resultCode, data);
     if (resultCode == Activity.RESULT_OK){
          // Recover the name of selected profile
          String myProfileName = data.getStringExtra("intentResultProfileName");
     }
}


2 - Run a task profile

String myProfileName = "Your profile name";

Intent intent = new Intent();
intent.setAction("com.wakdev.nfctools.pro.action.RUN_PROFILE");
intent.putExtra("PROFILE_NAME", myProfileName);
startActivity(intent);

 

WebAPP API GET METHOD


Here you can learn how to use nfc://scan/ and recover NFC data on a mobile website and more.

1 - Define your callback URL

First, you need a callback URL who recover NFC informations.
Eg : http://www.yourdomain.tld/index.php?tagid={TAG-ID}&text={NDEF-TEXT}

{TAG-ID} will be replaced automatically by NFC Tools with tag ID
{NDEF-TEXT} will be replaced automatically by NFC Tools with the last found NDEF text.

Check list of codes availables here :

{TAGID} : ID of NFC tag
{TAG-SIZE} : Current size of tag
{TAG-MAXSIZE} : Max size of tag
{TAG-TYPE} : Type of tag, eg : NTAG203
{TAG-ISWRITABLE} : Check if your tag is writable
{TAG-CANMAKEREADONLY} : Check if your tag can make read only

{NDEF-TEXT} : Last NDEF text record found
{NDEF-URI} : Last NDEF URI record found

More codes available soon...


2 - Make your html link

You need to encode you callback url.
In PHP you can use urlencode like this :

<?php
$callback_url = "http://www.youdomain.tld/";
$callback_url .= "?tagid={TAG-ID}";
$callback_url .= "&text={NDEF-TEXT}";
$encoded_callback_url = urlencode($callback_url);

$link = "nfc://scan/";
$link .= "?callback=".$encoded_callback_url;

?><a href="/<?php echo $link;?>">Click to scan NFC Tag</a>


3 - Recover your informations on your callback URL

For example if your callback URL is : http://www.yourdomain.tld/index.php?tagid={TAG-ID}&text={NDEF-TEXT}
in PHP you can use :

<?php
if (isset($_GET["tagid"])){
echo "My TAG ID : ".$_GET["tagid"];
}
if (isset($_GET["text"])){
echo "My NDEF text : ".$_GET["text"];
}
?>


4 - Example and test page

Try yourself with your Android device here : https://www.wakdev.com/contents/apps/nfctools/api/
Otherwise, you can download a test page here

WebAPP API POST METHOD


Soon...

About

Créateur de solutions innovantes
Android | iOS | Web | NFC

Keep in touch