Re: ANdroid with MiFare SDK issue…

Forum MIFARE SDK ANdroid with MiFare SDK issue… Re: ANdroid with MiFare SDK issue…

Re: ANdroid with MiFare SDK issue…

6. May 2015 at 22:09
You have not initialized and used they KeyStore. Also, you haven't used your LICENSE KEY to register the activity. If you are using Advanced MIFARE SDK (which I assume you do, because you use Inxpnfclibcallback).

If you do not use the Advanced MIFARE SDK, you are following wrong tutorials, as you need to follow a tutorial for LITE Version - or check my post below this one.

If you have your LICENSE KEY follow the below suggestions:


Add this before onCreate inside MainActivity

private IKeyStore ks = null;
public static final byte[] KEY_DEFAULT_FF = { (byte) 0xFF, (byte) 0xFF,
(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };


in your onCreate (inside MainActivity) write this:

libInstance = NxpNfcLib.getInstance();
// Get the Keys for Licensing and Cards
getKey();

create the method getKey(), here's my example:

private void getKey() {

try {
ks = KeyStoreFactory.getInstance().getSoftwareKeyStore();
ks.formatKeyEntry(0, IKeyConstants.KeyType.KEYSTORE_KEY_TYPE_MIFARE);
ks.setKey(0, (byte)0, IKeyConstants.KeyType.KEYSTORE_KEY_TYPE_MIFARE, KEY_DEFAULT_FF);
} catch (SmartCardException e) {
e.printStackTrace();
}
libInstance.loadKeyStore(ks);
libInstance.registerActivity(this, LICENSE_KEY);
}


And then use youre onNewIntent as you use it inside your example. It should work now.

If you haven't registered your App yet, you can do it here: https://inspire.nxp.com/mifare/

Hope it helps,
David
+ 0  |  - 0