在Android 13上获取SIM卡序列号

huangapple go评论85阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年7月10日 20:32:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/76653787.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定