Android Question user phone number validation

leitor79

Active Member
Licensed User
Longtime User
Hi,

This is not only a question about implementation, it's also a question about the best way to do it on b4a.

So, I'm making and app that performs an user registration automatically with his phone number to find people on his contact list that also uses the app. Yes, like whatsapp.

So, I need the user phone number.

First I've thought reading it from some configuration but, after reading a while, this sometimes doesn't works and I need to do it right everytime. So this option could be used as a suggestion, but I have to allow the user to write his own number. Yes, like whatsapp.

So, the problem with the user writing is own number is that he could write it wrong, by mistake or design, and I need to prevent that. So, I've came with the very original idea of using sms to validate it.. Yes, never seen before.

After googling a while I've came with two choices; 1) I have to send the user a sms with a code or 2) I have the app send a code to me and capture the number. So, there is my first question... is there an option 3? If the answer is "yes", please fill the blank: you have to __________________________________ and ________________________ because ______________________________ and you are so marvelous anyway. If the answer is "no", goto explain

explain:
First of all, you should never use a goto sentence.

IF there isn't a third option, I'm stuck with 1) or 2). I have to say I'd rather use option 1 because users could be reluctant to send an sms to an unknown number (a pitty; I would have sent the fortune of the prince of Nigeria to whose users who did it) but, If option 1 where too expensive for a starter I'd be starting with option 2.

So, for any of the options, I would need a kind of sms proxy, am I right? For option 1 I need one that could send sms to any country worldwide (or most countries; I would understand not delivering to north korea) and for option 2 I need one that receives sms from most countries. And, for both options, I need that would be not-expensive (ok, I'm still waiting the fortune of the prince of Nigeria), I understand option 1 would be more expensive and, and that's because I'm using this forum, It would be really nice to use any of those methods on basic4android (is there a library for that? an implementation? a recommendation?). I think this last thing would be a deal breaker for me to decide between the two options. I also appreciate recommendations about good and easy-to-use sms proxy.

For the process itself I think I got it right; take the simid of the user (well, his sim card) and send it to me (or my webservice, that would be better for my mental health) along with the phone number, then generate a code and associate it with the phone number and the simid and send it to the user so he can input it on the app and send back to me with his simid again to verify. The "send" and "send to the user" depends on the option I will use; sending by webservice and sending back by sms or the other way around.

I appreciate your help, thank you very much!






 

leitor79

Active Member
Licensed User
Longtime User
You can also get the phone number with PhoneId.GetLine1Number.
Hi Erel,

Thank you for your answer.

I understand GetLine1Number would fail sometimes (return emtpy string) according to some phone configuration (like mine). That's why I can't depend on it without verifying.

Regars,
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
I would not try to verify that number, and I'll tell you why, some users might have (like me for example) a Google number, so, when someone asks for my phone number that's the number I give, same thing if an app requires my phone number, forcing me to give my real number will force me to click the UNINSTALL APP button. :D

And like you said, some devices might also return a blank entry.
 
Last edited:
Upvote 0

leitor79

Active Member
Licensed User
Longtime User
I would not try to verify that number, and I'll tell you why, some users might have (like me for example) a Google number, so, when someone asks for my phone number that's the number I give, same thing if an app requires my phone number, forcing me to give my real number will force me to click the UNINSTALL APP button. :D

And like you said, some devices might also return a blank entry.

Hi NJ,

Thank you for your answer. It's OK if you have a google number; the verification I need is to check you are not using another person's number with a common contact between them. Imagine whatsapp if you could put another person's number; you will see all her/his contacts and impersonate her/him.

The idea of your number is because you will need to find your contacts on this app (like whatsapp); If you put a wrong number you will not find any match, that's on you, but I need to avoid any possible impersonation...

I don't like too much asking the phone number but as I see it I don't came with another option... but it would be welcome if there is another one.

Regards!
 
Upvote 0
Top