Developer Tip # 1

Forum / MIFARE SDK / Developer Tip # 1

Tagged: 

  • 2. February 2016 at 9:42
    MIFARE SDK provides two methods to add application logic i.e., either by using abstract class callback or filterintent. Advantage of first method is that you would not have auto generated code for unused cards in your application.

    Method 1 – Use NxpNfcLib abstract class callback where you need to add manually the methods for required cards detected as shown below:

    protected void onNewIntent(Intent intent) {
    Nxpnfcliblitecallback callback = new Nxpnfcliblitecallback() {

    OR

    Nxpnfclibcallback callback = new Nxpnfclibcallback() {

    public void onUltraLigthCardDetected(MifareUL objUlCard) {

    Log.i(TAG,"UltraLight Card Detected" ); objUlCard.getReader.connect();

    <your app logic>
    }
    libInstance.filterIntent(intent, callback);
    }


    Method 2 – Auto handlers using the libInstance.filterIntent (..) in onNewIntent () as shown below:

    protected void onNewIntent(Intent intent) {
    libInstance.filterIntent(intent, new Inxpnfclibcallback() {

    @Override
    public void onUltraLigthCardDetected(MifareUL objUlCard) {
    Log.i(TAG,"UltraLight Card Detected" );
    objUlCard.getReader.connect();
    <your app logic>

    } …………

    Please refer to the Javadoc documentation for the callbacks provided for each card/tag or the User Manual for more details.
    + 1  |  - 3
Viewing 1 post (of 1 total)

The topic ‘Developer Tip # 1’ is closed to new replies.