I have an app where visitors register from their phone numbers (much like WhatsApp or Telegram). I store the number in e164 format.
Once he is connected, the application synchronizes his contacts with the database in order to see which contact is using the application. during synchronization the application retrieves the list of numbers from its phonebook and converts them into E.164 format before sending them to the server. so far everything is working fine.
Here is where the problem arises: recently, a country (the Ivory Coast) has decided to change its phone numbers from 8 digits to 10 digits. What's the best way to handle this?
Treat a phone number as an arbitrary value until you can verify it works. Countries change the structure of their telephone numbers all the time and in unpredictable ways.
What is valid one day may not be valid the next. What rules apply one day may not apply the next. There is absolutely no way of knowing what might happen.
Phone numbers do not really adhere to any standard at all. E.164 only establishes the calling prefix, so that's something that might follow standards, but even those can change arbitrarily as countries get created, or merge.
In other words, this is all political and there is no way of predicting the future.
Related
I have checked the previous helpful suggestions on this topic and needed further clarity and help.
We are making a chat App. We require mobile number syncing from contacts. However my problem is here:
App can theoretically be used by anybody in the world. Let us say an US based user X has downloaded and is wanting to use it.
Once X registers, App starts syncing his contacts to display all of his contacts who are using this App.
X can have contacts from all over the world in his contact list and both landline and mobile numbers against various contacts.
For his US based contacts, X may have saved mobile numbers without countrycode, some with 001, some with country code +1.
For his foreign contacts, X may have saved landline/mobile number and those too in different formats (00 countrycode, + countrycode, with space, without space etc).
What i request help on is this:
When App starts syncing X's contacts to check if his contacts' mobile number also have my App (and this display that contact in my App's contacts), how do I check the individual contact's numbers, countrycodes and only mobile number? As going one country at a time is an inefficient way to do it, there must be some awesome solution here.
Any help please?
Thanks.
So basically on barlcays uk app you can have a button to direct call them from within the app.
The phone number is just a normal number +44 333.... doesn't seem to include any personal information or token about me/app.
So from the app it makes a call to this number +44 333... and I don't need to provide any information about me.
But if I call again the same number without the app I need to answer security questions.
So how do they do it? based on my current number and a small time interval?
Hi everyone i'am currently developing an android game, it uses your phone number when you first use the game(it is for an identification of the user).
It is an social game at some time when the user requests it returns a list of people who are currently online(playing the game),as json array(there phone number,name,photo)and from the data received you need to filter it out and display in two list views. The filtering done by this method:
1)Each element from JSON data(each person)if there phone number is found in user's contact list then is displayed in the first listview
2)if the number is not found in users contact list it is displayed in second listview.
But my doubt is that if the JSON array returns details of 10 people, you need to check for this 10 people whether they are in user's contact list.And does this kind of a technique takes a lot of time and creates delay in the UI..?
If yes please suggest me some other method.
Also please tell me how can I check whether a number is in user's contact list(I make the users upload there number to server without any country code).
So please in the number finding method you need to end the checking one a number has been fully completed.(starting from the end.
eg : 8086934565 (no saved in database) +918086934565(no in contact list)
then we need to start from last so that
5==5 then continue
6==6 then continue
till any of the no (+918086934565 or 8086934565) ends without breaking any equivalent condition.
eg for numbers +918086934565 and 8086933365
checking from the last
5==5,6==6, 5!=3 there the equivalent condition goes wrong and hence it should get out from the loop with a flag ie the numbers are not equal.
Please write me the function to do this or tell me an alternative method.
Any help would be appreciable.
Thanks.
Ugh, that's painful to read...haha...You're suggesting using phone numbers to identify users in a multiplayer matchmaking scenario? That's taboo...If you return a JSON array of users phone numbers, names, and photos, your app will almost certainly be permanently banned from the market and possibly your entire account. That is about the biggest security risk that I can possibly think of, you might as well have a textfield where everybody types in their social security number and it posts it to craigslist. Basically any of your users could just repeatedly initiate games with people and get names photos and phone numbers of 10 random people at a time by capturing the plain text JSON data coming back. If I were you I'd look into the facebook sdk for authentication or Google Play Game Services for multiplayer matchmaking unless the core mechanics of your game rely on phone numbers specifically, in which case by it's very nature is just not going to fly with users. Asking someone to write you a function to do that is most likely never going to happen on stackoverflow. I'm not even going to get into the last part of the question...This has to be a troll attempt...lol
I'm looking to install an android app on a set of tablets for internal company use. These tablets will be used in the field and I want the password to expire after 30 days and switch to a pre-determined (but random seeming) password every 30 days. I'd like that password to be unique for every tablet/install of the app. I will be installing the apps myself on each tablet before distribution.
I looked at various OTP schemes but couldn't find one that would work without requiring to connect to a server. To be honest, I've never done anything like this before and was a bit overwhelmed. Most of these tablets will not have access to internet while in the field and I'd like to be able to have users call in to get the next password after 30 days.
So ideally there's a pre-determined sequence of pseudo random numbers for each device, the user is given the password for this month and after 30 days, they have to call in to get the password for the current month for their specific tablet.
Hope this makes sense.
Thanks
Alright, I'll stream a couple of ideas I have about how you would achieve this.
My first thought when reading this was "You can do all of this through interacting with a Server, and frankly it would be easy with that support" until, of course, you noted that this wasn't possible.
I am making these suggestions under a few assumptions:
No one from your company is going to try to exploit the app in any way - like overbuffering or changing the apps language or utf settings etc etc. Also they won't try to look at any of the source files.
You will always get your hands on the devices before the people in your company use them.
Alright then, the handling of the 30-day predicament: The easiest way (though also most error prone way) would be to the get the systems current time (and date) when the user logs in, and set that "day" as counter "30 or "0." This can be done with Time now = new Time();
now.setToNow(); or Calendar c = Calendar.getInstance();. Store this "day" in your own SharedPreferences or just the DefaultSharedPreferences. Every time the app starts check this day with your current day, and calculate how many days it's been. If the current amount of days is 30 or greater, reset the password.
^This was one of the most simple, and also very "error...full?" (Couldn't think of a good word) ways to solve this. Now on to the passwords:
I would recommend using UUID for the passwords. Although the identifiers made aren't "technically" unique, the chances of getting the same password twice are...well so close to zero in your case it's probably not going to happen.
Generate these and store, lets say 1000 different ones into a file onto each device (a simple text file with each password on a different line will work), and save a copy in your own records (Make sure you know which passwords go to which device).
Then when that calendar counter from earlier goes off, set the password for the app as the "next" password in the file, deleting previous one from the file. The company employee calls you with his app Id (Generate an app ID the user can see in each app. So the first person who gets his app has app #1, the second is app#2 etc. so that you know which password file you should be reading from) you can send him the new password.
These are two veeeeeerrrryyy simple ways to handle this, but they might be able to at least get you thinking. Hope I helped a bit.
I am developing android application in which want to keep track of online users.
When the user install the app, he gives his number and country code, we register the user with that number.
Now whenever he starts the application he sends the list of all mobile contacts to server to find who is online.
The problem with this approach is same mobile number can be in different format like
+91 9665123456
91 9665123456
0 9665123456
9665123456
Lets assume while registering the user A gave number +91 9665123456 and we register the user and make it online whenever the app is running.
But in user B mobile, his number is stored as 09665123456, I need to query whether user A is online or not, but as both number are different what approach to use ?
I am not sure how whatsapp approaches to this problem?
The other way what I can think of is using libphonenumber to find the number match but it also gives probability.
Is there any other approach which is recommended to handle above scenario ?
I would suggest a below approach:
1, Your server should have a list of country codes and the corresponding number of digits allowed for a mobile number in that country
2, When the registered user A , comes online and sends his contacts to your server for the first time, you can check a contact by starting from the left end of the number. If you see a international prefix 00 or +, then take the first digit from left, identify the country code and if the remaining number of digits to the right match the defined number of digits for this country , scan the list of users registered with that country code to see a match. If no, then take the first 2 digits to see for a possible country code and check similarly.
Now if you dont see any international prefixes in a contact, that means the contact is in the same country as A and so you need to scan the list of users registered from the same country after taking the last certain number of digits as required for that country code.
3, It will be better if you generate a unique id for a each registered user which can be used as a primary key for a user database. This will eliminate the need for detailed scan for repeat users. For eg: let A have an id 123 and B have an id 456. When A logs in, set the online flag for A , then search for B and if B is already registered, then add B's id 456 to A's friends list along with corresponding number stored by A. So next time when A comes in, you will see that contact B has a unique ID assigned and so you need to go check if the online flag is set for this ID. Also this will be useful even if a user changes his/her number
I had a similar issue while developing an app. What you can do here is, to check the input for special characters, and also take the size in account. Remove the spaces, and store just the last 10 digits. This can be achieved by trimming and subString operations, if the entry type is a string. Then comparison of the two strings should result in a desired manner.
as per my suggestion
==> first of all you remove all space in your number using replace(" ","") function,
==> then use query for match last 10 character so its give you mobile number which you have want to find is there online or offline from users Contact book.