disable NFC Beam - Android Network

Android examples for Network:NFC

Description

disable NFC Beam

Demo Code


//package com.java2s;
import android.annotation.TargetApi;
import android.app.Activity;
import android.nfc.NfcAdapter;
import android.os.Build;

public class Main {
    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    public static void disableBeam(Activity activity) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            NfcAdapter adapter = NfcAdapter.getDefaultAdapter(activity);
            if (adapter != null) {
                adapter.setNdefPushMessage(null, activity);
            }/*  w  w w .j av a 2 s .c o m*/
        }
    }
}

Related Tutorials