Update from Thursday September 14th 2017:
The very same day I posted this (the day before yesterday), I realized that it looked like Google had just made it effectively obsolete
I thought that at least I could claim that I chose a very demanded functionality to blog about, since Google decided to add a new API to provide this very same service.
Even the names are quite similar, I called it "SMS Verifier" and they call it "SMS Retriever".
But after looking into this new Google Services API, I found out that it requires to use a paid third-party service such as Twilio... very disappointing!
So my original post (which follows below) is still relevant after all, since it allows you to verify the user's phone number for free.
Original post: Tuesday September 12th 2017
It was about time for me to give back to the open source community, so I have just pushed the complete (working) code to verify the user's phone number from within an Android app to Github.
When I googled this functionality (before deciding to write the code myself), I just found few code snippets such as this one, and I also realised that there is a company trying to monetize it through a pay-per-use web API.
But why would you need to verify the user's phone number?
Well, because I think the phone number is probably the best user identifier you can use for your mobile app.
I believe it is better than asking the user to create yet another user name (or email account) and password, or allow them to authenticate using Facebook or any other social network (not everybody has a Facebook account but obviously everybody who owns a phone has a SIM card, and hence, a phone number).
Even the product owner of Skype admitted it to me while in a tech talk at the Microsoft offices in Prague, when I asked how come WhatsApp became much more popular than Skype on mobile devices when the latter had a huge advantage since it already had the biggest share of the interpersonal communication market on PC before smart phones became mainstream.
WhatsApp registration and login was (ans still is) much simpler than Skype's, because it uses the user's phone number as identifier.
How many Skype accounts do you have? Or better, how many Skype accounts have you created? I must have created half a dozen myself, most of the people just create a new account when they forget or lose their password.
But with the phone number is a different story, most of the people just have one phone number at a time.
And why do you need to use SMS?
Because the same way a computer connected to the internet does not know her public IP address, a mobile device does not know his telephone number, only the network operator knows it, so we need to use SMS to verify that the phone number entered by the user is really theirs.
So what does the code do?
Well, better than explain it with words, just have look at the following diagram
But better, have a look to the code.
I followed the MVC model, so there are 3 main parent packages.
The model classes do not talk to any outer application classes.
The controller classes just talk to the model classes.
The view classes just talk to the controller classes.
The code seems to be working fine, but please note that I just pushed to the Github repository the files which I modified while coding this PoC app, so there are many files (mainly resource files) which are missing in the repo but they are simply the default files which you get when creating a new project using Android Studio.
The very same day I posted this (the day before yesterday), I realized that it looked like Google had just made it effectively obsolete
I thought that at least I could claim that I chose a very demanded functionality to blog about, since Google decided to add a new API to provide this very same service.
Even the names are quite similar, I called it "SMS Verifier" and they call it "SMS Retriever".
But after looking into this new Google Services API, I found out that it requires to use a paid third-party service such as Twilio... very disappointing!
So my original post (which follows below) is still relevant after all, since it allows you to verify the user's phone number for free.
Original post: Tuesday September 12th 2017
It was about time for me to give back to the open source community, so I have just pushed the complete (working) code to verify the user's phone number from within an Android app to Github.
When I googled this functionality (before deciding to write the code myself), I just found few code snippets such as this one, and I also realised that there is a company trying to monetize it through a pay-per-use web API.
But why would you need to verify the user's phone number?
Well, because I think the phone number is probably the best user identifier you can use for your mobile app.
I believe it is better than asking the user to create yet another user name (or email account) and password, or allow them to authenticate using Facebook or any other social network (not everybody has a Facebook account but obviously everybody who owns a phone has a SIM card, and hence, a phone number).
Even the product owner of Skype admitted it to me while in a tech talk at the Microsoft offices in Prague, when I asked how come WhatsApp became much more popular than Skype on mobile devices when the latter had a huge advantage since it already had the biggest share of the interpersonal communication market on PC before smart phones became mainstream.
WhatsApp registration and login was (ans still is) much simpler than Skype's, because it uses the user's phone number as identifier.
How many Skype accounts do you have? Or better, how many Skype accounts have you created? I must have created half a dozen myself, most of the people just create a new account when they forget or lose their password.
But with the phone number is a different story, most of the people just have one phone number at a time.
And why do you need to use SMS?
Because the same way a computer connected to the internet does not know her public IP address, a mobile device does not know his telephone number, only the network operator knows it, so we need to use SMS to verify that the phone number entered by the user is really theirs.
So what does the code do?
Well, better than explain it with words, just have look at the following diagram
But better, have a look to the code.
I followed the MVC model, so there are 3 main parent packages.
The model classes do not talk to any outer application classes.
The controller classes just talk to the model classes.
The view classes just talk to the controller classes.
The code seems to be working fine, but please note that I just pushed to the Github repository the files which I modified while coding this PoC app, so there are many files (mainly resource files) which are missing in the repo but they are simply the default files which you get when creating a new project using Android Studio.
Its an incredible joy perusing your post. It's brimming with data I am searching for and I want to post a remark that "The substance of your post is marvelous" Great work.
ReplyDeleteandroid app development courses in chennai