@Override protected void onPause() { super.onPause(); // disabling foreground dispatch: NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(this); if (nfcAdapter != null) { nfcAdapter.disableForegroundDispatch(this); } }