如何确定电话号码是否已更改? [英] How to determine if phone number has changed?

查看:155
本文介绍了如何确定电话号码是否已更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在为我的应用程序开发一个身份验证模块。用户提供他的电话号码和短信,并向他发送一些密码。

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.

用户输入密码,如果有效,他的电话号码将被验证。也许你知道WhatsApp,当你第一次运行应用程序时它会完全相同。

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.

然而,如果用户在手机中放入一张新的SIM卡,他应该再次验证它。

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

我想知道如何确定电话号码是否已更改。我在其他一些问题中读到无法确定电话号码数字本身。但是例如WhatsApp认识到还有另一个电话号码。

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.

任何想法?

推荐答案

更新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.

更新3

我建议您查看核心电话网络参考,尤其是 CTTelephonyNetworkInfo参考

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

subscriberCellularProviderDidUpdateNotifier 允许您回复事件例如:

subscriberCellularProviderDidUpdateNotifier allow you respond on events such like:


...当用户的手机提供商信息发生变化时。例如,如果用户
将设备的SIM卡与另一个提供商的一个
交换,而您的
应用程序正在运行

... 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

这篇关于如何确定电话号码是否已更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆