Exemplo n.º 1
0
        /// <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;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Register NFC Broadcast Receiver
 /// </summary>
 void RegisterListener()
 {
     _nfcBroadcastReceiver = new NfcBroadcastReceiver(OnNfcStatusChange);
     CurrentContext?.RegisterReceiver(_nfcBroadcastReceiver, new IntentFilter(NfcAdapter.ActionAdapterStateChanged));
 }