Udostępnij za pośrednictwem


SmsManager.SubscriptionId Property

Definition

Get the associated subscription id.

public int SubscriptionId { [Android.Runtime.Register("getSubscriptionId", "()I", "", ApiSince=22)] get; }
[<get: Android.Runtime.Register("getSubscriptionId", "()I", "", ApiSince=22)>]
member this.SubscriptionId : int

Property Value

associated subscription ID or SubscriptionManager#INVALID_SUBSCRIPTION_ID if the default subscription id cannot be determined or the device has multiple active subscriptions and and no default is set ("ask every time") by the user.

Attributes

Remarks

Get the associated subscription id. If the instance was returned by #getDefault(), then this method may return different values at different points in time (if the user changes the default subscription id).

<p class="note"><strong>Note:</strong> This method used to display a disambiguation dialog to the user asking them to choose a default subscription to send SMS messages over if they haven't chosen yet. Starting in API level 29, we allow the user to not have a default set as a valid option for the default SMS subscription on multi-SIM devices. We no longer show the disambiguation dialog and return SubscriptionManager#INVALID_SUBSCRIPTION_ID if the device has multiple active subscriptions and no default is set. </p>

Java documentation for android.telephony.SmsManager.getSubscriptionId().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to