SmsManager.Default 属性

定义

获取与默认订阅 ID 关联的 SmsManager。

public static Android.Telephony.SmsManager? Default { [Android.Runtime.Register("getDefault", "()Landroid/telephony/SmsManager;", "")] get; }
[<get: Android.Runtime.Register("getDefault", "()Landroid/telephony/SmsManager;", "")>]
static member Default : Android.Telephony.SmsManager

属性值

SmsManager 默认订阅 ID 关联的订阅 ID。

属性

注解

获取与默认订阅 ID 关联的 SmsManager。即使默认订阅 ID 发生更改,实例也会始终与默认订阅 ID 相关联。

<p class=“note”><strong Note:</strong>> For devices that support multiple active subscriptions at time, SmsManager will track the subscription set by the user set as the default SMS subscription. 如果用户尚未设置默认值, SmsManager 可以启动活动以启动订阅消除歧义对话框。 在用户选择与操作关联的订阅之前,大多数操作都不会完成。 如果用户取消对话框而不选择订阅,则会发生以下情况之一,具体取决于应用程序的目标 SDK 版本。 出于兼容性目的,如果目标 SDK 级别 <为 = 28,电话仍将通过第一个可用订阅发送短信。 如果目标 SDK 级别为 > 28,则操作将无法完成。 </p>

<p class=“note”><strong Note:</strong>> If this method is used to perform an operation on a device that has multiple active subscriptions, the user not set a default SMS subscription, and the operation is be perform while the application not in the foreground, the SMS disambation dialog will not shown. 操作的结果将结束,就像用户取消了消除歧义对话框一样,并且操作将如上所述完成,具体取决于调用应用程序的目标 SDK 版本。 如果应用程序在后台执行操作会更安全 #getSmsManagerForSubscriptionId(int) ,因为这可能会导致不可预知的结果,例如通过错误的订阅发送操作或完全失败,具体取决于用户的默认短信订阅设置。 </p>

此成员已弃用。 请改用 Context#getSystemService Context.getSystemService(SmsManager.class)

适用于 . 的 android.telephony.SmsManager.getDefault()Java 文档

本页的某些部分是根据 Android 开放源代码项目创建和共享的工作进行的修改,并根据 Creative Commons 2.5 属性许可证中所述的术语使用。

适用于