Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;

import android.nfc.NfcAdapter;
import android.os.Build;

public class Main {
    @TargetApi(16)
    static void disableAndroidBeam(Activity activity) {
        if (Build.VERSION.SDK_INT < 16)
            return;
        NfcAdapter nfcAdapter = getAdapter(activity);
        if (nfcAdapter != null)
            nfcAdapter.setBeamPushUris(null, activity);
    }

    @TargetApi(14)
    private static NfcAdapter getAdapter(Context context) {
        if (Build.VERSION.SDK_INT < 14)
            return null;

        return NfcAdapter.getDefaultAdapter(context.getApplicationContext());
    }
}