Example usage for android.nfc NfcAdapter EXTRA_READER_PRESENCE_CHECK_DELAY

List of usage examples for android.nfc NfcAdapter EXTRA_READER_PRESENCE_CHECK_DELAY

Introduction

In this page you can find the example usage for android.nfc NfcAdapter EXTRA_READER_PRESENCE_CHECK_DELAY.

Prototype

String EXTRA_READER_PRESENCE_CHECK_DELAY

To view the source code for android.nfc NfcAdapter EXTRA_READER_PRESENCE_CHECK_DELAY.

Click Source Link

Document

Int Extra for use with #enableReaderMode(Activity,ReaderCallback,int,Bundle) .

Usage

From source file:com.macleod2486.androidswissknife.views.NFC.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.nfc, container, false);

    tool = new NFCTool(getActivity());

    writeNFC = (Button) view.findViewById(R.id.writeNFC);
    writeNFC.setOnClickListener(tool);/*from  w  w  w. jav a  2 s.  c  o m*/

    clearText = (Button) view.findViewById(R.id.clearText);
    clearText.setOnClickListener(tool);

    Log.i("NFCTool", "Scanning");

    NfcManager manager;
    NfcAdapter adapter;

    manager = (NfcManager) getActivity().getSystemService(getActivity().getApplicationContext().NFC_SERVICE);
    adapter = manager.getDefaultAdapter();

    NFCCallback callback = new NFCCallback(getActivity());

    Bundle opts = new Bundle();
    opts.putInt(NfcAdapter.EXTRA_READER_PRESENCE_CHECK_DELAY, 5000);

    adapter.enableReaderMode(getActivity(), callback, NfcAdapter.FLAG_READER_NFC_A, opts);

    Toast.makeText(this.getActivity(), "Please scan tag with device.", Toast.LENGTH_LONG).show();

    return view;
}