disable NFC Foreground - Android Network

Android examples for Network:NFC

Description

disable NFC Foreground

Demo Code


//package com.java2s;

import android.app.Activity;

import android.nfc.NfcAdapter;

public class Main {
    private static NfcAdapter nfcAdapter = null;

    public static void disableForeground(Activity activity) {
        if (!isAvailable())
            return;
        nfcAdapter.disableForegroundDispatch(activity);
        nfcAdapter.disableForegroundNdefPush(activity);
    }/*from  w w  w .  ja  v  a 2  s  .  com*/

    public static Boolean isAvailable() {
        if (nfcAdapter != null && nfcAdapter.isEnabled())
            return true;
        else
            return false;
    }
}

Related Tutorials