英文:
Retrieving Sim Serial Number on Android 13
问题
在Flutter中,我想获取SIM卡的序列号。我使用了sim_data_plus这个包。对于Android 12及以下版本,它运行得非常完美。但即使该包声称支持Android 12及以上版本,我也无法读取在运行Android 13的手机中的SIM卡的序列号。我并不打算获取手机号码,我打算获取SIM卡的序列号。
英文:
In Flutter, I want to get the serial number of the sim. I used the package sim_data_plus. It works perfectly fine for Android 12 and lesser versions. But even though the package says that it provides support for Android 12 and above, I am not able to read the serial number of a sim present in a phone running on Android 13. I do not intend to get the mobile number, I intend to get the sim serial number.
答案1
得分: 1
根据安卓官方的文档,在 Android 10 或更高版本上无法获取 SIM 卡序列号。
-
如果你的应用没有相应的权限,但尝试获取不可重置的标识信息,平台的响应会根据目标 SDK 版本而变化:
-
如果你的应用目标为 Android 10 或更高版本,则会发生 SecurityException 异常。如果你的应用目标为 Android 9 (API 级别 28) 或更低版本,并且应用具有 READ_PHONE_STATE 权限,则该方法会返回 null 或占位符数据。否则,会发生 SecurityException 异常。
英文:
It is not possible to get sim serial number android 10 or higher
According to android's official document
-
If your app doesn't have the permission and you try asking for
information about non-resettable identifiers anyway, the platform's
response varies based on target SDK version: -
If your app targets Android 10 or higher, a SecurityException occurs.
If your app targets Android 9 (API level 28) or lower, the method
returns null or placeholder data if the app has the READ_PHONE_STATE
permission. Otherwise, a SecurityException occurs.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论