I have two phone numbers +17896786788 and +322657579849. I would like to retrieve only the code I.e, +1 and +322 by passing these phone number.
Is there any API avalable to get the code out of phone number?
libphonenumber gives the country code for the given country. Link: libphonenumber ios get country code for country
But I would like to get the code out of phone number.
I spent a long time investigating this, and so far there is no way to do this on iOS.
Sure we can make a guess, and it would work in most cases, but there is always some cases where it will be difficult, let me give you a few exemples:
Canada and USA share the same international prefix: +1
Martinique is part of France, but has its own international prefix: +596
Taiwan can be considered part of China or not depending on the user's interpretation
And the list goes on..
Related
I have been trying to find an API which gives the current country's emergency contact number (i.e. for US 911, India 100,101,102).
Is there any way to get the emergency call number using my current location?
I already checked Programmatically making an emergency call on iPhone, but it does not return the current county's emergency number.
There is no API in Cocoa Touch to get such information based on user's location
I'm having a problem receiving Messages and i don't know where and what goes wrong.
Right now i received messages from the United States that are shown in the Inbound Twilio Dashboard and are accessible through the API.
e.g.:
<% #client.account.sms.messages.list({ from: "#{#contact.mobile}", }).each do |message| %>
Bur responses from other countries don't show up anywhere.
For Sending and receiving messages i use the format:
+1757*******
Has the format something to do with it ? What am i missing?
From Twilio Doc:
Phone numbers should be formatted with a '+' and country code e.g.,
+16175551212 (E.164 format). For 'to' numbers without a '+', Twilio will use the same country code as the 'from' number. Twilio will also
attempt to handle locally formatted numbers for that country code
(e.g. (415) 555-1212 for US, 07400123456 for GB). If you are sending
to a different country than the 'from' number, you must include a '+'
and the country code to ensure proper delivery.
After some serious Twilio Scanning i found the Answer - Read below
Twilio Evangelist here.
This could be a number of things. So first off, do the incoming messages show in your Message Logs on the Twilio Dashboard?
If they don't show up, then you make sure you have a URL set for number receiving them.
If they do show up, copy one of the numbers as shown in the logs and try this out in your app. It's a little tricky to be specific without more details, but I expect you should use the +<country><number> format as stated. So for US: +1415xxxx..., for the UK +447590xxxx...' and so on.
You could also try running this code:
<% #client.account.messages.list({to: your_twilio_number}).each do |message| %>
Display all the messages and check for the inbound messages there, then try again once you've double checked your contact.mobile formatting.
Hope this helps.
For everyone with the Same Issue.
When Setting up a Twilio account you receive a US Number, which works a little different from other Countries.
SMS Enabled Phone Numbers: Some are able to send SMS internationally and domestically, but others are only able to send and receive SMS domestically.
For the United States there is no Mobile, only Toll-Free and Local. With that, other carriers (Outside the US) wont even let your sms trough, thinking that the number on the other end is not a Mobile.
Basically, only US Numbers can send an SMS to a US Number, other countries can't.
So i bought a UK Number and everything is working now.
I am creating an app that allows users to find friends via address book contacts. Users have to enter their own phone number(including area code) when they sign up. Given an user A, I currently compare phone numbers in the database(phone numbers gathered from sign up) with user A's address book contacts. However, I noticed that some contacts on my phone do not have area codes. Is there a way to ascertain whether two numbers are the same when no area code is available?
I would suggest storing the area code and number separately. This way, you would be able to compare non area coded phone numbers with some degree of confidence, as opposed to just checking against the last 7 digits of a 10+ digit phone number.
I am interested in building an app that has a Find Friends by contacts function similar to Path's or Instagram's but am not sure how it's done.
I know Path and Instagram upload your address book to their server, but how are they able to tell if a particular contact is also using the app? Does it also upload the user's phone number and thus match by phone numbers?
CLARIFICATION: I do not save email addresses (or any info other than the contact's phone number) in my address book, yet somehow Path and Instagram are able to tell if that phone number belongs to a user on Path / Instagram. How is this?
There are two join points between your address book and theirs:
Your e-mail address (and phone number).
Your friends address books that contain your e-mail address (and phone number).
Basically, just because you don't have their e-mail address listed doesn't mean they don't have yours listed. They could also filter this "who has your e-mail in their address book" based on the names and/or phone numbers in your address book.
Yes, it could also be joining on phone number. The point here is that there are many ways to join data together, and your phone doesn't have the complete picture of what they have.
I want to be able to replicate what the AddressBook does in Contacts app and Phone app when entering a phone number in both the keypad on the Phone app and adding a contact.
I know I could do it checking each time a character is entered into the UITextField but there are hundreds of number formats out there and it would take me forever to code it all.
Is there any API to this I can use or any known open source code I could use at all?
The UIPhoneFormats.plist contains predefined phone formats for each locale. You'll need to write code to subsitute your input string into these string masks. I had to do something similar, and I shared the results I got here: http://the-lost-beauty.blogspot.com/2010/01/locale-sensitive-phone-number.html
You hit the nail on the head - check the characters typed each time.