Beispiel #1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            //Inflates the layout for this fragment
            View     v       = inflater.Inflate(Resource.Layout.main_fragment, container, false);
            EditText account = (EditText)v.FindViewById(Resource.Id.card_account_field);

            account.SetText(AccountStorage.GetAccount(Activity), TextView.BufferType.Editable);
            account.AddTextChangedListener(new AccountUpdater()
            {
                Activity = this.Activity
            });
            return(v);
        }
Beispiel #2
0
        public override byte[] ProcessCommandApdu(byte[] commandApdu, Bundle extras)
        {
            Log.Info(TAG, "Received APDU: " + ByteArrayToHexString(commandApdu));
            // If the APDU matches the SELECT AID command for this service,
            // send the loyalty card account number, followed by a SELECT_OK status trailer (0x9000)

            // Check if the values inside of commandApdu are the same as SELECT_APDU
            bool arrayEquals;

            if (SELECT_APDU.Length == commandApdu.Length)
            {
                arrayEquals = true;
                for (int i = 0; i < SELECT_APDU.Length; i++)
                {
                    if (SELECT_APDU [i] != commandApdu [i])
                    {
                        arrayEquals = false;
                        break;
                    }
                }
            }
            else
            {
                arrayEquals = false;
            }

            if (arrayEquals)
            {
                String account      = AccountStorage.GetAccount(this);
                byte[] accountBytes = Encoding.UTF8.GetBytes(account);
                Log.Info(TAG, "Sending account number: " + account);
                return(ConcatArrays(accountBytes, SELECT_OK_SW));
            }
            else
            {
                return(UNKNOWN_CMD_SW);
            }
        }
Beispiel #3
0
            public void AfterTextChanged(IEditable s)
            {
                String account = s.ToString();

                AccountStorage.SetAccount(Activity, account);
            }