0

I am new to Android. Currently, I am developing an application which performs credit card transaction where each time the payment is made, phone will be connected to the card reader through the audio jack port. In order to make payment successful, credit card will be authorized where user needs to enter PIN(pin will be entered from card reader). At this stage, application will prompt a dialog box where it request user to enter the PIN. So, here is the hardest part. When the dialog box appears, user shall enter their PIN number from the pin pad(from the card reader that is connected to the phone) instead of entering from the soft keypad(from phone).I have been googled around but seems I haven't met what I looked for and I noticed that in order to do this, I need to implement the Input Method Manager. I am still figuring out how this can be done and I really appreciate if any of you could help me for the solution. Thanks in advance

Here is the code where the dialog box appears

final EditText et = new EditText(ICCardActivity.this);                      
                        new AlertDialog.Builder(ICCardActivity.this)
                                .setTitle(title)
                                .setView(et)
                                .setPositiveButton("OK",
                                        new DialogInterface.OnClickListener() {
                                            @Override
                                            public void onClick(
                                                    DialogInterface arg0,
                                                    int arg1) {
                                                _pin = et.getText().toString();
                                            }
                                        })
                                .setNegativeButton("Cancel",
                                        new DialogInterface.OnClickListener() {
                                            @Override
                                            public void onClick(
                                                    DialogInterface arg0,
                                                    int arg1) {
                                                _pin = "";
                                            }
                                        }).show();
                        sendMessage(title + " with pinpad! try count=" + ucPinTryCnt);
sopi
  • 85
  • 1
  • 9
  • I do not understand -- as the PIN is being entered on the external reader, what sort of input do you expect on the android side? I can't imagine something other than a "flat" message like "Please enter your PIN on the external reader" which disappears after you get the result from the external reader. – vlp Feb 28 '16 at 21:26
  • User will enter PIN number through pin pad(card reader) and I want to pass the PIN value in EditText which available in Alert Dialog(as in the code).I figured out and found a method named onKey(), which I have tried but still stuck with this. – sopi Feb 29 '16 at 10:54
  • 2
    Hmm...card readers with a PIN pad (i.e. providing "Secure PIN Entry") usually work different. You ask the card reader to perform PIN verification and you are given only the result (see e.g. [here](http://www.pcscworkgroup.com/specifications/files/pcsc10_v2.02.09.pdf)). The idea behind this is to protect the entered PIN from potential malicious code present on the computer system (as the actual PIN value is not processed here). What you are asking for is violating this principle -- thus my confusion. Good luck! – vlp Feb 29 '16 at 22:32

0 Answers0