Exception: TapLinX registration failed after Free Trial. Provide Valid License Key on get card type

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Exception: TapLinX registration failed after Free Trial. Provide Valid License Key on get card type

622 Views
Liam_H
Contributor II

Hello,

We are using the taplinx android SDK and are experiencing an intermittent issue on some of our devices. The following error is  being thrown when trying to get the card type from a tag discovered intent:

   com.nxp.nfclib.exceptions.NxpNfcLibException: TapLinX registration failed after Free Trial. Provide Valid License Key
    at com.nxp.nfclib.if.apduExchange(:34)
    at com.nxp.nfclib.ˋ.getReader(:67)
    at com.nxp.nfclib.NxpNfcLib.getCardType(:340)
    at com.nxp.nfclib.NxpNfcLib.getCardType(:278)
    at com.bcom.taplinx.TapLinxHelper.readCard(TapLinxHelper.java:64)
    at mono.java.lang.RunnableImplementor.n_run(Native Method)
    at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:31)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:205)
    at android.os.Looper.loop(Looper.java:294)
    at android.app.ActivityThread.main(ActivityThread.java:8223)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:977)
 
When the application activity is created the taplinx library is registered to the activity successfully with both an online and offline key.  Intermittently on some devices we receive the above error when reading a tag from intent.
 
We are using the following code based on the starting development guide to initialize and read tags:
public class TapLinxHelper {
public static final String TAG = "TapLinx";

// The TapLinX library instance
private NxpNfcLib tapLinxInstance = null;

public boolean IsInitialized = false;

public boolean initializeLibrary(Activity activity, String key, String offlineKey) {
tapLinxInstance = NxpNfcLib.getInstance();

try {
if(offlineKey != null && !offlineKey.isEmpty()) {
tapLinxInstance.registerActivity(activity, key, offlineKey);
}else{
tapLinxInstance.registerActivity(activity, key);
}
} catch (NxpNfcLibException ex) {
Log.d(TAG, "onNewIntent");
return false;
} catch (Exception e) {
// do nothing added to handle the crash if any
return false;
}

IsInitialized = true;
return true;
}

public void onResume() {
if (tapLinxInstance != null) {
tapLinxInstance.startForeGroundDispatch();
}
}

public void onPause() {
if (tapLinxInstance != null) {
tapLinxInstance.stopForeGroundDispatch();
}
}

public CardResult readCard(final Intent intent, int applicationID, int cardKeyNumber, byte[] applicationKey, int fileID) {
CardType cardType = tapLinxInstance.getCardType(intent); // error intermittently thrown at this point
if (cardType != CardType.DESFireEV3) {
throw new IllegalStateException("Unexpected value: " + cardType);
}

Log.d(TAG, "Card type: " + cardType.getTagName());

try {
IDESFireEV3 desFireEV3 = DESFireFactory.getInstance().getDESFireEV3(tapLinxInstance.getCustomModules());
desFireEV3.getReader().connect();

CardResult result = new CardResult();
result.CardType = desFireEV3.getType().getTagName();
result.UID = Utilities.dumpBytes(desFireEV3.getUID());

// generate the key
SecureKeyGenerator keyGenerator = SecureKeyGenerator.getInstance(tapLinxInstance.getCustomModules());
IKeyData key = keyGenerator.getKeyFromKeyBytes(applicationKey, KeyType.AES128);

// select the application
desFireEV3.selectApplication(applicationID);

// authenticate
desFireEV3.authenticate(cardKeyNumber, IDESFireEV1.AuthType.AES, KeyType.AES128, key);

// read data
result.Data = desFireEV3.readData(fileID, 0, 0);

return result;
} catch (Exception e) {
Log.d(TAG, e.getMessage());
}

return null;
}

}
Are you able to offer any insight on to what might cause this error to be thrown after successfully registering the activity?
 
Thank you in advance for your help.
 
Kind Regards,
Liam
 
Labels (1)
Tags (1)
0 Kudos
Reply
2 Replies

520 Views
Liam_H
Contributor II

Hello Jimmy,

 

Thank you for your help,  we had followed all the steps described and license string were populated.

I have now modified our implementation so that it ensures the activity is registered before proceeding with a read card, this appears to have fixed the issue. 

Thanks again for your help and have a nice day.

 

Kind Regards,

0 Kudos
Reply

584 Views
jimmychan
NXP TechSupport
NXP TechSupport

Hello,

 

Are you followed all steps described here: https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/Get-started-with-TapLinx/ta-p/1709890? Do you populate license string before the code you shared?

 

Also if you can provide full package name (in secure way) so we can check the back end.

0 Kudos
Reply