Partager via


SubscriptionManager.SetCarrierPhoneNumber(Int32, String) Method

Definition

Sets the phone number for the given subId for source #PHONE_NUMBER_SOURCE_CARRIER carrier.

[Android.Runtime.Register("setCarrierPhoneNumber", "(ILjava/lang/String;)V", "GetSetCarrierPhoneNumber_ILjava_lang_String_Handler", ApiSince=33)]
[Android.Runtime.RequiresPermission("carrier privileges")]
public virtual void SetCarrierPhoneNumber (int subscriptionId, string number);
[<Android.Runtime.Register("setCarrierPhoneNumber", "(ILjava/lang/String;)V", "GetSetCarrierPhoneNumber_ILjava_lang_String_Handler", ApiSince=33)>]
[<Android.Runtime.RequiresPermission("carrier privileges")>]
abstract member SetCarrierPhoneNumber : int * string -> unit
override this.SetCarrierPhoneNumber : int * string -> unit

Parameters

subscriptionId
Int32

the subscription ID, or #DEFAULT_SUBSCRIPTION_ID for the default one.

number
String

the phone number, or an empty string to remove the previously set number.

Attributes

Remarks

Sets the phone number for the given subId for source #PHONE_NUMBER_SOURCE_CARRIER carrier. Sets an empty string to remove the previously set phone number.

The API is suitable for carrier apps to provide a phone number, for example when it's not possible to update #PHONE_NUMBER_SOURCE_UICC UICC directly.

It's recommended that the phone number is formatted to well-known formats, for example, by PhoneNumberUtilsformatNumber* methods.

Java documentation for android.telephony.SubscriptionManager.setCarrierPhoneNumber(int, java.lang.String).

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