/// <summary> /// Unregister NFC Broadcast Receiver /// </summary> void UnRegisterListener() { if (_nfcBroadcastReceiver == null) { return; } try { CurrentContext?.UnregisterReceiver(_nfcBroadcastReceiver); } catch (Java.Lang.IllegalArgumentException ex) { throw new Exception("NFC Broadcast Receiver Error: " + ex.Message); } _nfcBroadcastReceiver.Dispose(); _nfcBroadcastReceiver = null; }
/// <summary> /// Register NFC Broadcast Receiver /// </summary> void RegisterListener() { _nfcBroadcastReceiver = new NfcBroadcastReceiver(OnNfcStatusChange); CurrentContext?.RegisterReceiver(_nfcBroadcastReceiver, new IntentFilter(NfcAdapter.ActionAdapterStateChanged)); }