has Default NFC Adapter - Android Network

Android examples for Network:NFC

Description

has Default NFC Adapter

Demo Code


//package com.java2s;

import android.content.Context;

import android.nfc.NfcAdapter;
import android.nfc.NfcManager;

public class Main {
    public static boolean hasDefaultAdapter(Context context) {
        final NfcManager nfcManager = (NfcManager) context
                .getSystemService(Context.NFC_SERVICE);
        if (nfcManager == null) {
            return false;
        }// www . j av a2s.  c  o m

        final NfcAdapter nfcAdapter = nfcManager.getDefaultAdapter();
        return (nfcAdapter != null);
    }
}

Related Tutorials