Google's phone number handling library
code.google.com
code.google.com
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.
One note: it would be nice if you explicitly stated, in the LICENSE file or the readme, that this is under the MIT license. It'd make it easier to use this at companies (like mine) where open source packages can only be used if their license is on a legal-department-approved whitelist.
thanks for the jquery plugin, I'll definitely keep it in mind!
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...
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.
If Google is the only consumer, then Google only has to test internally that they didn't break something with an update. If tons of apps are consumers then they need to either test with many more apps, or worse just simulate buggy old behaviour for apps to keep things consistent (see Windows/Win32/etc).
If apps house their own copy of the library, then that version is static for that app's context, which likely means it won't break randomly in the future. That's good for the app developer (better back and forward compatibility), better for Google (less testing, less maintaining compatibility), and less headaches for consumers (as apps won't break as often when updating Android).
This reminds me of one of my favourite quotes: "If something in software doesn't make sense, then assume it is there for compatibility reasons." Which I think is a Raymond Chen quote that I've mangled.
We were trying to use Twilio and Authy on an application but they handle phone numbers in a different way. Say you accept a phone number from Argentina, to call mobile phones from outside the country you need to add a 9. Twilio accepts that 9 and correctly sends SMS or calls to that number but Authy only accepts the local number format without the 9 and have a big IF to add the 9 internally. So, if for some reason the application must use a phone number in Twilio AND Authy you will need to accept two phone numbers from the user (that are the same in different formats), which is... annoying.
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.
Often when you're developing an app, even one completely in open source, you aren't designing all parts of it for maximum reusability. There are tons of private APIs in most apps, including most open source apps.
It's usually after the application which drove the development of the utility code in the first place is finished and stabilized, that people go back and figure out how to refactor it to make it generally more useful.
As someone who does a lot of telephony work, <333
http://www.mjt.me.uk/posts/falsehoods-programmers-believe-ab...
The requirements for the work I did meant that we had to support the UK's NLPG standard for addresses which didn't even work for the house I live in so I knew I was off to a bad start :)
Really nice.