Results 1 to 9 of 9
  1. #1


    Member Since
    Oct 18, 2011
    Posts
    160
    Signing Up With Mobile
    Hi,

    I am in the process of building a new app. The app allows users to signup with their mobile number (including the country prefix), which they then verify with a SMS.

    When the user has signed up, the app checks the users contacts in their phonebook to see which of their contacts is already signed up and using the app too. It then adds each of these contact to a Friends list.

    I have a big problem which i can't seem to get my head around:

    Most mobile numbers start with a 0 when they are used within their own country, such as 087 123 4567 for Ireland... however each country also has their own country prefix, such as +353 for Ireland, and when we use the prefix code, we usually drop the 0, such as +353 87 123 4567

    As i mentioned above, the app uses the mobile number as your unique identifier and checks to see which of your friends are already using the app. Some users will have their friends saved as 087 333 4444 and others will have them saved with the country prefix +353 87 333 4444 and therefore the app will not recognise the simple version of 087 333 4444

    Can anyone think of a way of resolving this? Thanks in advance for your help.

  2. #2

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,782
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    Moved to the development forum.

    The solution is here is rather simple - simply read the first character of the phone number string, check to see if it's a zero and then do something accordingly. If it isn't, they likely have the country code at the front.

    I'm not sure what language you're using here but effectively, you want something that lets you get a slice of a string.
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  3. #3


    Member Since
    Oct 18, 2011
    Posts
    160
    Hey, thanks for your reply.

    Sometimes users save the +353 as 00353 too, so the proposal above wouldn't work.

    Any other ideas?

  4. #4

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,782
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    You'll need to code a conditional that accounts for all possibilities. As far as I can tell, there's no way around that unless you read only the last seven digits or so and use that as a unique identifier. This would get around having to deal with the beginning part of the string. That would give you ten million possible unique combinations (0000000 - 9999999). Granted, that wouldn't account for area/country codes though. However, you could run a check against the DB if one of those seven digit codes matched another and then assign a different number based on that (or have a second column for area/country code).
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  5. #5


    Member Since
    Oct 18, 2011
    Posts
    160
    Thanks Vansmith, i have thought of this, however i don't think that will work either as a mobile number in the US could have the last 7 digits the same as a mobile in Ireland.

    US: 1 (555) 555 5555
    Ireland: 087 555 5555

  6. #6

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,782
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    Hence the second column for country code.

    So, if the seven digit numbers are the same, consult the second column with the country code. Your psuedocode would look something like:
    Code:
    variable number = get results from phone column
    variable countrycode = get result from country code column
    if number == what the user input then
         check to see if number exists elsewhere in the column
         if it doesn't then
              ...do what you need to do...
         if it does exist elsewhere then
              get the country code input by the user
              check country code against the country codes in the rows with number
              if the countrycode == what the user input && the number == what the user input then
                   ...do what you need to do...
    It's not the most elegant psuedocode but it should do the job of explaining what it is that I'm trying to explain.
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  7. #7


    Member Since
    Oct 18, 2011
    Posts
    160
    Ha, yes i get you but problem is that we are relying on how users are saving their friend's phone numbers in their actual phonebook, some will not have a country code prefix and others will :-)

    I wonder would using the last 8 digits be safe (maybe not)

  8. #8

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,782
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    Quote Originally Posted by oo7ml View Post
    Ha, yes i get you but problem is that we are relying on how users are saving their friend's phone numbers in their actual phonebook, some will not have a country code prefix and others will :-)
    You can't account for all user choices.

    Quote Originally Posted by oo7ml View Post
    I wonder would using the last 8 digits be safe (maybe not)
    Maybe but you're still going to run into an issue where the beginning of the phone number string will differ.

    One thing to note as well is the existence of shared country codes. For example, North American countries all have the same country code (1). It might help reading this.
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  9. #9


    Member Since
    Oct 18, 2011
    Posts
    160
    Yeah, i know Whatsapp are able handle this so they must use some clever method.

    All of the options i can think of don't cover all choices.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. signing in
    By riegal in forum OS X - Operating System
    Replies: 13
    Last Post: 04-13-2015, 08:25 PM
  2. Apple's iPhone 4 wins Best Mobile Device award at Mobile World Congress
    By the8thark in forum Apple Rumors and Reports
    Replies: 0
    Last Post: 02-16-2011, 09:07 PM
  3. Anyway to get 3G without signing contract?
    By Haaru in forum iPhone Hardware and Accessories
    Replies: 14
    Last Post: 06-29-2008, 12:07 AM
  4. msn keeps signing off
    By w...b in forum OS X - Apps and Games
    Replies: 0
    Last Post: 11-27-2005, 10:19 PM
  5. msn keeps signing off
    By w...b in forum Apple Notebooks
    Replies: 0
    Last Post: 11-27-2005, 10:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •