private void StartNfc_Click(object sender, EventArgs e)
        {
            text.Text = contactName;


            // The `keys` array is used for pads and nfc exchange
            // But GetBlockOfEntropyBytes destroys the data from the string builder,
            // and we need a copy of it for calculating compression... so keep `key` and `keys`
            key = EntropyManager.GetBlockOfEntropyBytes();
            while (key != "__NO_ENTROPY__")
            {
                keys.Add(key);
                key = EntropyManager.GetBlockOfEntropyBytes();
            }

            // Compute quality of entropy by running compression
            string inputStr = key;

            byte[] compressed; // output byte array after compression

            using (var outStream = new MemoryStream())
            {
                using (var gzipStream = new GZipStream(outStream, CompressionMode.Compress))
                    using (var inStream = new MemoryStream(Encoding.UTF8.GetBytes(inputStr)))
                        inStream.CopyTo(gzipStream);

                compressed = outStream.ToArray();
            }

            // Calculate compression ratio - use floats because % will be between 0-1, but we want the decimal accuracy
            float compressionRatio = ((float)inputStr.Length - (float)compressed.Length) / (float)inputStr.Length;

            // TODO: display compression ratio to user to indicate entropy quality
            // NOTE: ^ lower compression = better! :: "Compression ratio: " + compressionRatio*100 + "%"
            Toast.MakeText(ApplicationContext, "Compression ratio: " + compressionRatio * 100 + "%", ToastLength.Long).Show();
            // NFC exchange
            _nfcAdapter.SetNdefPushMessageCallback(this, this);
            _nfcAdapter.SetOnNdefPushCompleteCallback(this, this);
            text.Text = "Move Your Phone Near Your Friend's";
        }
        public void OnSensorChanged(SensorEvent e)
        {
            if (!recording)
            {
                return;
            }
            EntropyManager.FeedData(e.Sensor.Type, e.Values);

            progStatus = (EntropyManager.GetSbSize() * 100) / EntropyManager.GetTotalSbSize();

            RunOnUiThread(() =>
            {
                progBar.IncrementProgressBy(progStatus - oldStatus);
            });
            oldStatus = progStatus;

            if (progBar.Progress >= 100)
            {
                finishedGen.Enabled = true;
                text.Text           = "Finished generating a set of keys";
                _sensorManager.UnregisterListener(this);
            }
        }