Live data from Hacker News

Google's phone number handling library

code.google.com

11–20 of 44 posts

Re: Google's phone number handling library

#11
Ha, good to see this here - so incredibly useful, and already ported to lots of useful languages. Handling phone numbers gets messy really quickly: formatting/validation for national/international numbers, in different forms (land-line/mobile/premium etc), in hundreds of different countries... These guys have done a great job, and are also super responsive/helpful when you raise issues.

A word of warning: if you ever set out to handle international numbers in a web frontend - you may think "it can't be that hard - maybe take me a couple of hours" (like me), then do yourself a favour and save yourself a week of unexpected work and use the jQuery plugin that I ended up creating (I don't understand why this didn't already exist) which uses libphonenumber for all the magic: https://github.com/Bluefieldscom/intl-tel-input. Hope it saves you some time.

Re: Google's phone number handling library

#14
post #5

Not entirely sure how this made front page, but it is a super handy lib. I don't understand why Android includes this lib in their source but makes it internal so you have to provide your own copy if you want to use it in your app: https://android.googlesource.com/platform/external/libphonen...

>> Not entirely sure how this made front page, but it is a super handy lib. Sad that nowadays a statement like that isn't even considered ironic :). A cross-platform library handling an ugly necessity of development has to fight for its life in a sea of "growth hacking 101" links and the like.

That's true, I totally agree with you at its irony in hindsight. I guess I'm a bit blinded at having worked on Android apps for a while and using this lib way too often.

Re: Google's phone number handling library

#15
post #4

Not entirely sure how this made front page, but it is a super handy lib. I don't understand why Android includes this lib in their source but makes it internal so you have to provide your own copy if you want to use it in your app: https://android.googlesource.com/platform/external/libphonen...

The reason it's internal is because system code takes priority over third party libraries given the same package name. If there were any changes to the library, you could never use the newest version because it would be dominated by the system version. This is what happened to the Apache HttpClient and why there is a fully repackaged version[1] for people who want to use a newer client than the one in the Android Sys…

Yeah but it's already namespaced differently so package name shouldn't conflict. But now that I think about it more, consistent versioning for the 3rd party dev across multiple OS versions is pretty important.

Re: Google's phone number handling library

#16
I guess I shouldn't but One thing that surprises me is the lack of developer friendly libraries like this coming out of major corporations that should know better.

Why, for example, is Stripe leading the charge on decent credit card front ends when Visa could spend a few million and produce the one and only Unicode, works everywhere, looks up addresses credit card entry form.

Why is an advertising company doing this when any of the major telcos have this internal knowledge lying around?

The blindness does seem almost wilful at times.

Re: Google's phone number handling library

#17
post #5

Not entirely sure how this made front page, but it is a super handy lib. I don't understand why Android includes this lib in their source but makes it internal so you have to provide your own copy if you want to use it in your app: https://android.googlesource.com/platform/external/libphonen...

>> Not entirely sure how this made front page, but it is a super handy lib. Sad that nowadays a statement like that isn't even considered ironic :). A cross-platform library handling an ugly necessity of development has to fight for its life in a sea of "growth hacking 101" links and the like.

It's an extremely specific library and anyone who needs this sort of thing will easily find it in their search.

Re: Google's phone number handling library

#18
post #13

I've been using this for quite a while -- it's excellent -- without a doubt the best library around for dealing with phone numbers in E.164 format (the international standard). As someone who does a lot of telephony work, <333

Exactly. It comes in super handy when you have a free(ish) form text field where the users enter their number which you want to later use (say for 2FA).
Post reply on HN