Send verification code to Android Device and show in Dialog - android

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.

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

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
}
});

Related

PushNotification "dryRun" attribute for iOS

For Android devices I am using dryRun attribute to control message is delivered to device or not, generally I have used this parameter to check the pntoken is invalid or not without sending a sample message to device.
I am searching for same attributes or a way to check whether token is valid, expired or invalid for IOS devices.
There is no Dry run option for iOS but you might want to go with message without any alert.
{
"aps": {
"category": "categoryName"
}
}
With above payload call will go through but nothing should show up on the device.
Based on this documentation, to run a quick test of your push notification setup for Apple Push Notification Service (APNS), use the Send Test Notification page.
Here are the steps that you need to do.
Enter a connection token string in the Recipient field, OR search for a recipient by clicking Search, and then select one of the search results. By default, the Search results list displays the five devices most recently registered for your connected app.
a. To find other devices, enter a user name in the Search text box.
b. Click Go to generate a list of all devices currently registered under that user name.
Optionally, for Alert, enter an alert message or dictionary per Apple’s specifications.
For Badge, enter a badge number or 0 for no badge.
For Sound, enter the name of a sound file in the application bundle, or enter default to use the system default alert sound.
Optionally, to use a custom payload, enter your payload’s JSON value in the Custom Payload field.
Click Send to send the test push notification, or click Clear to reset the form.
For more information, check this SO question and this thread if it can help you.

Android mobile number verification

Hi guys I need help from you all in Android mobile number verification process. I have a android phone I just need to verify the otp but in this case they using the auto verification method is it possible to verify my otp through fwd the msg or by using prank message app Pls anyone help me to solve my problem and thx in advance...
Assuming that you are asking for "how to implement OTP verification". There are number of ways to tackle this. Please look at the below link for two ways of achieving this using Google authenticator or using a SMS gateway.
Android one time password (OTP)
here is the tutorial to read the incoming messages using Broadcast receiver if you are going to use the second method.
"Reading incoming messages using broadcast receiver."
I believe you are trying to implement a way you can implement your own TTS (Text-To-Speech) Verification system that prompts the user to enter in the code.
If so, you can use Nexmo's Text To Speech Prompt.
All you have to do is make an HTTP call (For example: https://api.nexmo.com/tts-prompt/json)
From here you can use the parameters you want such as,
text - Body of the text message to be read to the end user
machine_detection - How to react when an answering machine is detected
lg - To determine what language the text is read in
bye_text - Body of the text message played after digits are entered successfully
failed_text - Body of the text message played after 3 failed attempts
There are many other parameters you can work with and customize your TTS prompt to capture/confirm data.
Full disclosure, I work at Nexmo
You can see more information how to implement this here

Mobile app: how to show the OTP my app sends in a popup without leaving my app?

We've had to code an OTP based authentication. I have seen some apps, like my bank's app, which when it sends the OTP also then immediately does a quick popup of the SMS that has just arrived, so I can see the OTP without leaving the app. I just memorize the number, close the popup, and get on with the login inside that app.
How do they do that? Is there some iOS/Android spec I should be looking at, which allows us to similarly popup the OTP without the user having to go to the SMS screen, then come back to our app? Thanks!
EDIT: I have very useful Android suggestions. Now looking for iOS variations of these recommendations. Understand iOS has much more stringent sandboxing limitations, so the "listener" may be more complex?
For android you need to use SMSListener as pointed out by #rushabh.
You can check at a great example here
Some Tips to achieve your mention task for your App.
Step - 1 create a Login Activity with necessary field like username , password and otp and Login Button.
Step - 2 When user fill the username and password make a web service call. with input params (username and password)
authenticate the values if true means send your OTP number as response else response error message.
Step -3 if response is number means create AlertBuilder for Pop window to show your OTP number in same Activity.
Step - 4 user saw the OTP in Login Activity itself and enters the OTP in opt area i.e (EditText).
Step - 5 When user tap the login Button authenticate the OTP value. and proceed to next Activity.

Facebook apprequest messages are not displayed on receiver's notifications list

I am trying to send a direct message to friends using Facebook Dialogs on Android. The code that does is as follows:
Bundle params = new Bundle();
params.putString("message", "sending direct messages");
params.putString("to", friendId);
mFacebook.dialog(FBFriendsActivity.this, "apprequests", params, new PostDialogListener());
The code executes well. No error. The Facebook send dialog shows up, and I click on send. but, I do not see any notifications listed on the receiver's notifications.
Do I have to have a facebook app in order for this to work? If so, how do I send user-to-user requests?
I would assume one of three things.
You application is still in test mode
The app request went to a test user rather than a normal user account
Most importantly, your app may not be properly configured as a canvas app.
See https://developers.facebook.com/docs/reference/dialogs/requests/ for more information
what do you mean by "direct message"? inbox message? I don't think Facebook Android API supports this...
yes, you need a Facebook app, otherwise how do you instantiate mFacebook? Suppose it is Facebook mFacebook = new Facebook("YOUR_APP_ID");. But I think you do have your Facebook app, because you said a dialog had shown and you had clicked the send.
for your code, that is what you would do if you want to send app requests to your friends.
you may want to take a look at this tutorial which shows you the key steps for the Facebook integration.
https://developers.facebook.com/docs/mobile/android/build/#register

Sending message using facebook android sdk

I wish to develop an Android app where the user can send messages by clicking a button and the send dialog box should appear whereby the user can send personal message to his friends.
However, this is not well documented in the FB site.
The feed dialog is appearing without error and I can post to wall but when I replace "feed" with "send", it gives an error saying "An error ouccured with MyApp. Pls. try again later.
http://developers.facebook.com/docs/guides/mobile/#android
The last item in the android post is how to get post dialog method.
You can't send in general but there could be some workaround... But that couldn't be generalized in that way... Because you have to use an API for that and there is not currently any support for that what I suppose you can read but can't write... http://developers.facebook.com/blog/post/291 is the reference for details...
You can't send a message with the Dialog (source: http://developers.facebook.com/docs/reference/androidsdk/dialog/):
void dialog(Context context, String action, DialogListener listener)
action - The type of dialog to call. Currently supported methods are feed, apprequests and oauth.
So, "send" is not a supported method.

Categories

Resources