如何获取来电的 sim id(默认拨号器)
How to get sim id for incoming call (Default dailer)
当应用程序是默认拨号器时,我需要一种方法来获取来电(双卡)的 sim id(1 或 2)。
应用正在实施 InCallService。
看起来您可以 运行 call.getDetails().getAccountHandle().getId()
,这将 return 作为该 PhoneAccountHandle 标识符的字符串。
请注意,PhoneAccountHandle 也是 return 来自 getSimCallManager
的
这是 PhoneAccountHandle 文档的注释:
A string that uniquely distinguishes this particular
PhoneAccountHandle from all the others supported by the connection
service that created it.
A connection service must select identifiers that are stable for the
lifetime of their users' relationship with their service, across many
Android devices. For example, a good set of identifiers might be the
email addresses with which with users registered for their accounts
with a particular service. Depending on how a service chooses to
operate, a bad set of identifiers might be an increasing series of
integers (0, 1, 2, ...) that are generated locally on each phone and
could collide with values generated on other phones or after a data
wipe of a given phone. Important: A non-unique identifier could cause
non-deterministic call-log backup/restore behavior.
您还可以运行 getPhoneAccount(phoneAccountHandlerFromAbove) 获取地址() 即phone 账户号码。
如果您想将其与系统中的事物顺序进行比较,您可以使用 getCallCapablePhoneAccounts
检索所有 PhoneAccountHandle 的列表
当应用程序是默认拨号器时,我需要一种方法来获取来电(双卡)的 sim id(1 或 2)。
应用正在实施 InCallService。
看起来您可以 运行 call.getDetails().getAccountHandle().getId()
,这将 return 作为该 PhoneAccountHandle 标识符的字符串。
请注意,PhoneAccountHandle 也是 return 来自 getSimCallManager
的这是 PhoneAccountHandle 文档的注释:
A string that uniquely distinguishes this particular PhoneAccountHandle from all the others supported by the connection service that created it.
A connection service must select identifiers that are stable for the lifetime of their users' relationship with their service, across many Android devices. For example, a good set of identifiers might be the email addresses with which with users registered for their accounts with a particular service. Depending on how a service chooses to operate, a bad set of identifiers might be an increasing series of integers (0, 1, 2, ...) that are generated locally on each phone and could collide with values generated on other phones or after a data wipe of a given phone. Important: A non-unique identifier could cause non-deterministic call-log backup/restore behavior.
您还可以运行 getPhoneAccount(phoneAccountHandlerFromAbove) 获取地址() 即phone 账户号码。
如果您想将其与系统中的事物顺序进行比较,您可以使用 getCallCapablePhoneAccounts
检索所有 PhoneAccountHandle 的列表