phone-number

Android - cant get phone number of some contacts

那年仲夏 提交于 2019-12-01 12:21:54
I'm having a problem with extracting phone numbers of some people in my contact list. First I show all the contacts in a listview: String[] projection = new String[] { ContactsContract.Contacts._ID, ContactsContract.CommonDataKinds.Phone.CONTACT_ID, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER }; mCursor = mContext.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, projection, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + "=?", new String[] {mContactId}, null); When clicking on an item, this is how I fetch

Validating UK phone numbers in PHP

牧云@^-^@ 提交于 2019-12-01 12:10:33
I purchased a contact form. Great little thing but I need to convert the validation for the phone number to allow for UK number formats - in other words, to allow for spaces. Right now it validates without spaces and has a minimum length of 8 characters: if(is_numeric($phone)) { if(!$phone || strlen($phone) < 8) { $error .= "Please enter your phone number without spaces.<br />"; } } else { $error .= "Please enter numeric characters in the phone number field.<br />"; } David Barker Phone numbers are typically horrible for regex patterns, which is what you will need. This pattern for example:

Programmatically get own Phone Number in iPhone OS 4.0

流过昼夜 提交于 2019-12-01 10:44:55
I am developing an iPhone application for jail broken phones and in this application I would like to fetch user's phone number. I have gone through the entire stackoverflow.com and found some relevant answers but all of them are obsolete and doesn't work with iOS 4.0 anymore. The most famous solution for this problem is NSString *num = [[NSUserDefaults standardUserDefaults] stringForKey:@"SBFormattedPhoneNumber"]; but as I mentioned this solution no more works with iOS 4.0 As my application is intended towards the jail broken phones and not intended the Apple app store so I am not worried

Validating UK phone numbers in PHP

≡放荡痞女 提交于 2019-12-01 10:41:52
问题 I purchased a contact form. Great little thing but I need to convert the validation for the phone number to allow for UK number formats - in other words, to allow for spaces. Right now it validates without spaces and has a minimum length of 8 characters: if(is_numeric($phone)) { if(!$phone || strlen($phone) < 8) { $error .= "Please enter your phone number without spaces.<br />"; } } else { $error .= "Please enter numeric characters in the phone number field.<br />"; } 回答1: Phone numbers are

Programmatically get own Phone Number in iPhone OS 4.0

吃可爱长大的小学妹 提交于 2019-12-01 09:09:54
问题 I am developing an iPhone application for jail broken phones and in this application I would like to fetch user's phone number. I have gone through the entire stackoverflow.com and found some relevant answers but all of them are obsolete and doesn't work with iOS 4.0 anymore. The most famous solution for this problem is NSString *num = [[NSUserDefaults standardUserDefaults] stringForKey:@"SBFormattedPhoneNumber"]; but as I mentioned this solution no more works with iOS 4.0 As my application

Can I get user's phone number by requesting for permission in ios 6? [duplicate]

大兔子大兔子 提交于 2019-12-01 08:12:49
问题 This question already has answers here : Programmatically get own phone number in iOS (9 answers) Closed 6 years ago . I am building an IOS6 app which requires the user's phone number, Is there a way to ask the user for permission and get the number in programmatic way? Or he has to manually type it in? I am using Xcode 4.5 if it matters.. 回答1: You can't get the phone via any easy API within iOS. There might be a way to do it via the technique described in this related question, but this is a

How to construct a telephone number link on Android that includes an extension

牧云@^-^@ 提交于 2019-11-30 17:42:06
On a web page I have a link to a telephone number with extension like this: <a href="tel:011234404,123456">call now</a> When I tap this link in an iPhone browser, the iPhone will dial 011234404 and then when the call is answered it will dial the extension 123456. This is wonderful, however it does not appear to work at all on android (the main number is dialed and the extension is ignored). Other people seem to be using ";" or even "p" instead of the comma separator on Android with some success, but I am unable get anything to work. What is the standard for this type of link on Android? Please

Javascript RegExp - extract phone numbers from string

≯℡__Kan透↙ 提交于 2019-11-30 14:51:39
I have the following working regex to extract a lot of phone numbers in different formats. See here: http://jsfiddle.net/SB5Ly/4/ var regex = new RegExp( "\\+?\\(?\\d*\\)? ?\\(?\\d+\\)?\\d*([\\s./-]?\\d{2,})+", "g" ); .... (If the script didn't load, press the "Run" button from the top menu) As you can see in the example (by following the link), the last 2-3 phone number formats (var phoneNumbers) doesn't match the used regex. You can test the regex modifying it in the script and running it. So i need a regex that match all the enumerated phone number formats (to extract them from an entire

android: how do I format number as phone with parentheses

蹲街弑〆低调 提交于 2019-11-30 12:42:12
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? 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 numberProto = phoneUtil.parse(numberStr, "US"); //Since you know the country you can format it as follows: System

Is there a gem that normalizes and format US phone numbers in ruby?

ε祈祈猫儿з 提交于 2019-11-30 12:08:10
I was using phony to format phone numbers (meaning, if I put in xxx-xxx-xxxx it would convert to a string, and also tell if there is a (1) before to remove it). But it really doesn't work for us phone number, it's designed for international numbers. Is there an equivalent? Thanks. http://rubygems.org/gems/phony Earlier this year, I reviewed a bunch of ruby gems that parse and format phone numbers. They fall into a number of groups (see below). TLDR: I used 'phone'. It might work for you because you can specify a default country code that it uses if your phone number doesn't include one. 1) US