List of usage examples for android.nfc NfcAdapter isNdefPushEnabled
@java.lang.Deprecated public boolean isNdefPushEnabled()
From source file:com.brq.wallet.activity.receive.ReceiveCoinsActivity.java
@TargetApi(16) protected void shareByNfc() { if (Build.VERSION.SDK_INT < 16) { // the function isNdefPushEnabled is only available for SdkVersion >= 16 // We would be theoretically able to push the message over Ndef, but it is not // possible to check if Ndef/NFC is available or not - so dont try it at all, if // SdkVersion is too low return;//from w ww .jav a 2s . co m } NfcAdapter nfc = NfcAdapter.getDefaultAdapter(this); if (nfc != null && nfc.isNdefPushEnabled()) { nfc.setNdefPushMessageCallback(new NfcAdapter.CreateNdefMessageCallback() { @Override public NdefMessage createNdefMessage(NfcEvent event) { NdefRecord uriRecord = NdefRecord.createUri(getPaymentUri()); return new NdefMessage(new NdefRecord[] { uriRecord }); } }, this); ivNfc.setVisibility(View.VISIBLE); ivNfc.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Utils.showSimpleMessageDialog(ReceiveCoinsActivity.this, getString(R.string.nfc_payment_request_hint)); } }); } else { ivNfc.setVisibility(View.GONE); } }