0

A friend of mine showed me his home office today. After he was logging in with his username and password on a website, he received a message on his Android smartphone with a verification code for the website, a 2-factor authentication system. The message appeared inside a Dialog with a confirm Button. I'm just wondering how you can send a message to an Android device, so it will be displayed like this. I tried to search for this, but all I can find is just how to set up Dialogs in Android.

Alex Cio
  • 6,014
  • 5
  • 44
  • 74

2 Answers2

1

Due to the abstract nature of your question, Heres an approach.

Firstly you would need to tie up with an sms provider.There are lots of them with their set of apis and pricing (for eg http://www.twilio.com)

Secondly in android you could listen for incoming messages. Android – Listen For Incoming SMS Messages

Hope this helps

Community
  • 1
  • 1
humblerookie
  • 4,717
  • 4
  • 25
  • 40
  • Thanks! Think this one looks like a possibility to solve this problem: https://www.twilio.com/docs/howto/two-factor-authentication. Was just wondering because it also was no SMS and what settings have to be set to create the message inside the Dialog – Alex Cio Sep 09 '14 at 08:46
-1

There are various option, but I guess you can use this:

AlertDialog alert = new AlertDialog.Builder(Myclass.this).create();
alert.setTitle("Verfication code");
alert.setMessage("your verification code is "+xyz);

alert.setButton("confirm",new DialogInterface.onClickListener(){
      public void onClick(DialogInterface d, int x){
       //logic
      }
});
Nikhil
  • 300
  • 1
  • 5
  • 18