mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
Merge pull request #1133 from Rrego6/development
Check if NFC is available on device
This commit is contained in:
commit
67a9f12790
@ -25,6 +25,7 @@ import android.annotation.TargetApi;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ActivityOptions;
|
import android.app.ActivityOptions;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@ -374,6 +375,11 @@ public class ViewKeyActivity extends BaseActivity implements
|
|||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||||
private void invokeNfcBeam() {
|
private void invokeNfcBeam() {
|
||||||
|
//Check if device supports NFC
|
||||||
|
if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC)) {
|
||||||
|
Toast.makeText(this, R.string.no_nfc_support, Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Check for available NFC Adapter
|
// Check for available NFC Adapter
|
||||||
mNfcAdapter = NfcAdapter.getDefaultAdapter(this);
|
mNfcAdapter = NfcAdapter.getDefaultAdapter(this);
|
||||||
if (mNfcAdapter == null || !mNfcAdapter.isEnabled()) {
|
if (mNfcAdapter == null || !mNfcAdapter.isEnabled()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user