Dela via


TelephonyManager.Line1Number Property

Definition

Returns the phone number string for line 1, for example, the MSISDN for a GSM phone for a particular subscription.

public virtual string? Line1Number { [Android.Runtime.Register("getLine1Number", "()Ljava/lang/String;", "GetGetLine1NumberHandler")] get; }
[<get: Android.Runtime.Register("getLine1Number", "()Ljava/lang/String;", "GetGetLine1NumberHandler")>]
member this.Line1Number : string

Property Value

Attributes

Remarks

Returns the phone number string for line 1, for example, the MSISDN for a GSM phone for a particular subscription. Return null if it is unavailable.

The default SMS app can also use this.

Requires Permission: android.Manifest.permission#READ_SMS READ_SMS, android.Manifest.permission#READ_PHONE_NUMBERS READ_PHONE_NUMBERS, that the caller is the default SMS app, or that the caller has carrier privileges (see #hasCarrierPrivileges) for any API level. android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE for apps targeting SDK API level 29 and below.

This member is deprecated. use SubscriptionManager#getPhoneNumber(int) instead.

Java documentation for android.telephony.TelephonyManager.getLine1Number().

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