How to determine if a phone number has changed?

I am currently developing an authentication module for my application. The user provides his phone number, and an SMS message with his pin code is sent to him.

The user enters a code, and if valid, his phone number is authenticated. Perhaps you know WhatsApp, it’s not at all the same when you launch the application for the first time.

However, if the user puts a new SIM card in his phone, he must authenticate it again.

I want to know how to determine if a phone number has changed. I read in another question that it is impossible to determine the phone number myself. But, for example, WhatsApp recognizes that there is a different phone number.

Any ideas?

+5
source share
1 answer

Update 2

One (not the best) way to detect media changes. Here you can see how to get the name of the operator. Save it the first time you run it and do the comparison on the next starts.

Update 3

I would recommend that you look at the Link to the basic telephone network and especially to the Link CTTelephonyNetworkInfo

subscriberCellularProviderDidUpdateNotifier allow you to respond to events such as:

... when changing the information of the mobile operator. This happens, for example, if a user replaces a device’s SIM card with one from another provider while your application is running

+7
source

All Articles