Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine if phone number has changed?

Currently I am developing an authentication module for my application. The user provides his phone number and a SMS with some pin code is send to him.

The user enters the code and if it is valid his phone number is authenticated. Maybe you know WhatsApp, it does quite the same when you run the app first time.

However if the user puts a new sim card in his phone he should authenticate it again.

I want to know how to determine if phone number has changed. I read in some other question that it is not possible to determine the phone number itself. But e.g. WhatsApp recognizes that there is another phone number.

Any ideas?

like image 516
UpCat Avatar asked May 11 '11 06:05

UpCat


1 Answers

Update 2

One (not the best) way it's detecting carrier changing. Here you can see how to get carrier's name. Save it at first launch and do compare on next launches.

Update 3

I'd recommend to you look at Core Telephony Network reference and especially at CTTelephonyNetworkInfo reference

subscriberCellularProviderDidUpdateNotifier allow you respond on events such like:

... when the user’s cellular provider information changes. This occurs, for example, if a user swaps the device’s SIM card with one from another provider, while your application is running

like image 186
5hrp Avatar answered Sep 21 '22 07:09

5hrp