libphonenumber

Using PhoneNumberFormattingTextWatcher without typing country calling code

こ雲淡風輕ζ 提交于 2020-01-23 12:27:14
问题 In the login panel of my app, I divided the country calling code and the remaining numbers in two editable TextView as below: I want to use international formatting standard in the TextView on the right. If a user who has a phone number as +905444444444 types in number in these boxes, I want to see "90" in the box on the left and "544 444 4444" on the right. For this reason, I tried to use the following implementation that uses libphonenumber: /** * Watches a {@link android.widget.TextView}

Phone number format from country code on iOS

佐手、 提交于 2020-01-13 06:53:29
问题 I need to display phone number format as placeholder in UITextField . How can I do that? For country selection I'm using below mentioned library and it provides me country flag and country code against user selected country. https://github.com/NikKovIos/NKVPhonePicker After selecting a country I need to display phone number format for that selected country and on submission of that phone number I have to validate the phone number. I also find that third party ( PhoneNumberKit ) which is

How to get country code from mobile number using libphonenumber api in Android [duplicate]

雨燕双飞 提交于 2020-01-01 03:43:27
问题 This question already has answers here : Extract code country from phone number [libphonenumber] (6 answers) Closed 2 years ago . I am using libphonenumber api https://code.google.com/p/libphonenumber/ in android project, I am getting country code using following code PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance(); try { PhoneNumber numberProto = phoneUtil.parse(number, "IN"); int countryCode = numberProto.getCountryCode(); } catch (NumberParseException e) { System.err.println(

android: how do I format number as phone with parentheses

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-30 04:13:13
问题 I have a number that I need to format as a telephone number. If I do PhoneNumberUtils.formatNumber(numStr); Then I get 888-555-1234 But what I need to get is (888) 555-1234 How do I get the second one? Is there a standard android way? 回答1: If you know the country for which you want to do it, you can use Google's open source library libphonenumber . Here is how you can format it: String numberStr = "8885551234" PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance(); try { PhoneNumber

iOS Convert phone number to international format

…衆ロ難τιáo~ 提交于 2019-12-23 12:24:54
问题 In my iOS app I have to convert a phone number (taken in the contacts) and convert it in international format (to send SMS automatically with an extern library). I saw libPhoneNumber but the problem is that we have to enter the country code, and the app have to work in all (almost) countries, so I don't know what is the user's country. Here is how the library works : let phoneUtil = NBPhoneNumberUtil() let phoneNumberConverted = try phoneUtil.parse("0665268242", defaultRegion: "FR") // So I

How to use Google libphonenumber in Typescript?

别等时光非礼了梦想. 提交于 2019-12-14 03:32:05
问题 I want to use Google libphonenumber in my angular project using Typescript. I have searched a lot on internet and found a lot of stuff but could not find anything that could serve my purpose. Most of the content available shows the code in JavaScript. If I use the same code in typescript, it shows lot of error like 'cannot find name require' or 'module not found'. Please tell me how/where/what to write the code. Also, plz tell me which package to install as there are many - libphonenumber,

google libphonenumber get only mobile numbers from contacts

时光毁灭记忆、已成空白 提交于 2019-12-13 02:26:07
问题 I'm using libphonenumber to format phonenumbers in contacts. Is there any way to display only mobile numbers like WhatsApp? no local phone numbers. The only idea I have is to have a list with all mobile area codes like https://en.wikipedia.org/wiki/List_of_mobile_phone_number_series_by_country and check every number but this is a bit complicated I think. 回答1: found the answer... PhoneNumberUtil.PhoneNumberType nrtype = phoneUtil.getNumberType(NumberProto); if (nrtype.name() == PhoneNumberUtil

libphonenumber javascript - validating

你说的曾经没有我的故事 提交于 2019-12-12 16:51:44
问题 I am absolutely new to javascript development. What I need is validating a mobile number to enable sms after some time. What I've found is googles libphonenumber : https://code.google.com/p/libphonenumber/ There is a compiled javascript file (closure-compiler) in the source trunk an I thought, I could simply do the following: function buildAndValidatePhone(phoneNumber, countryCode) { var strIntlNumber = "invalid"; try { var phoneUtil = i18n.phonenumbers.PhoneNumberUtil.getInstance(); var