gpt4 book ai didi

android - 短信电话号码验证的替代方案 - 全局

转载 作者:行者123 更新时间:2023-11-29 13:25:21 28 4
gpt4 key购买 nike

我一直在尝试寻找一种无需使用 SMS 验证系统即可验证电话号码(Android 和 iPhone)的方法。原因纯粹是围绕成本。我想要一个免费的解决方案。

我可以安全地假设 Android 操作系统会向我提供用户的电话号码(无需验证),使其成为免费解决方案吗?iOS 怎么样?

感谢大家的帮助。

最佳答案

Android 允许您获取电话号码。您的应用需要用户的 READ_PHONE_STATE 权限。

然后像这样获取电话号码就很简单了:

TelephonyManager tMgr =(TelephonyManager)mAppContext.getSystemService(Context.TELEPHONY_SERVICE);
mPhoneNumber = tMgr.getLine1Number();

ios 不允许您获取用户的电话号码。他们认为这是一种安全风险。

一位尝试过此操作的开发人员收到了苹果的回复:

"For security reasons, iPhone OS restricts an application (including its preferences and data) to a unique location in the file system. This restriction is part of the security feature known as the application's "sandbox." The sandbox is a set of fine-grained controls limiting an application's access to files, preferences, network resources, hardware, and so on."

The device's phone number is not available within your application's container. You will need to revise your application to read only within your directory container and resubmit your binary to iTunes Connect in order for your application to be reconsidered for the App Store.

因此,您可能仍需要使用 SMS 服务。祝你好运!

关于android - 短信电话号码验证的替代方案 - 全局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13265449/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com