Added in API level 28

ApnSetting


open class ApnSetting : Parcelable
kotlin.Any
   ↳ android.telephony.data.ApnSetting

An Access Point Name (APN) configuration for a carrier data connection.

The APN provides configuration to connect a cellular network device to an IP data network. A carrier uses the name, type and other configuration in an APNSetting to decide which IP address to assign, any security methods to apply, and how the device might be connected to private networks.

Use ApnSetting.Builder to create new instances.

Summary

Nested classes
open

Provides a convenient way to set the fields of a ApnSetting when creating a new instance.

Constants
static Int

Authentication type for CHAP.

static Int

Authentication is not required.

static Int

Authentication type for PAP.

static Int

Authentication type for PAP or CHAP.

static Int

MVNO type for group identifier level 1.

static Int

MVNO type for ICCID.

static Int

MVNO type for IMSI.

static Int

MVNO type for service provider name.

static Int

Internet protocol.

static Int

Virtual PDP type introduced to handle dual IP stack UE capability.

static Int

Internet protocol, version 6.

static Int

Transfer of Non-IP data to external packet data network.

static Int

Point to point protocol.

static Int

Transfer of Unstructured data to the Data Network via N6.

static Int

APN type for BIP.

static Int

APN type for CBS.

static Int

APN type for default data traffic.

static Int

APN type for DUN traffic.

static Int

APN type for Emergency PDN.

static Int

APN type for ENTERPRISE.

static Int

APN type for accessing the carrier's FOTA portal, used for over the air updates.

static Int

APN type for HiPri traffic.

static Int

APN type for IA Initial Attach APN.

static Int

APN type for IMS.

static Int

APN type for MCX (Mission Critical Service) where X can be PTT/Video/Data

static Int

APN type for MMS traffic.

static Int

APN type for RCS (Rich Communication Services).

static Int

APN type for SUPL assisted GPS.

static Int

APN type for VSIM.

static Int

APN type for XCAP.

Inherited constants
Public methods
open Int

open Boolean
equals(other: Any?)

open String!

Returns the name of the APN.

open Int

Returns the bitmask of APN types.

open Int

Returns the authentication type of the APN.

open Int

Returns the carrier id for this APN.

open String!

Gets the human-readable name that describes the APN.

open Int

Returns the unique database id for this entry.

open InetAddress!

Gets the MMS proxy address configured for the APN.

open String!

Returns the MMS proxy address of the APN.

open Int

Returns the MMS proxy port of the APN.

open Uri!

Returns the MMSC Uri of the APN.

open Int

Returns the default MTU (Maximum Transmission Unit) size in bytes of the IPv4 routes brought up by this APN setting.

open Int

Returns the MTU size of the IPv6 mobile interface to which the APN connected.

open Int

Returns the MVNO match type for this APN.

open Int

Returns a bitmask describing the Radio Technologies (Network Types) which this APN may use.

open String!

Returns the numeric operator ID for the APN.

open String!

Returns the APN password of the APN.

open Int

Returns the profile id to which the APN saved in modem.

open Int

Returns the protocol to use to connect to this APN.

open InetAddress!

Gets the HTTP proxy address configured for the APN.

open String!

Returns the proxy address of the APN.

open Int

Returns the proxy address of the APN.

open Int

Returns the protocol to use to connect to this APN while the device is roaming.

open String!

Returns the APN username of the APN.

open Int

open Boolean

Returns whether User Plane resources have to be activated during every transition from CM-IDLE mode to CM-CONNECTED state for this APN See 3GPP TS 23.

open Boolean

Returns the current status of APN.

open Boolean

Returns if the APN setting is persistent on the modem.

open Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<ApnSetting!>

Constants

AUTH_TYPE_CHAP

Added in API level 28
static val AUTH_TYPE_CHAP: Int

Authentication type for CHAP.

Value: 2

AUTH_TYPE_NONE

Added in API level 28
static val AUTH_TYPE_NONE: Int

Authentication is not required.

Value: 0

AUTH_TYPE_PAP

Added in API level 28
static val AUTH_TYPE_PAP: Int

Authentication type for PAP.

Value: 1

AUTH_TYPE_PAP_OR_CHAP

Added in API level 28
static val AUTH_TYPE_PAP_OR_CHAP: Int

Authentication type for PAP or CHAP.

Value: 3

MVNO_TYPE_GID

Added in API level 28
static val MVNO_TYPE_GID: Int

MVNO type for group identifier level 1.

Value: 2

MVNO_TYPE_ICCID

Added in API level 28
static val MVNO_TYPE_ICCID: Int

MVNO type for ICCID.

Value: 3

MVNO_TYPE_IMSI

Added in API level 28
static val MVNO_TYPE_IMSI: Int

MVNO type for IMSI.

Value: 1

MVNO_TYPE_SPN

Added in API level 28
static val MVNO_TYPE_SPN: Int

MVNO type for service provider name.

Value: 0

PROTOCOL_IP

Added in API level 28
static val PROTOCOL_IP: Int

Internet protocol.

Value: 0

PROTOCOL_IPV4V6

Added in API level 28
static val PROTOCOL_IPV4V6: Int

Virtual PDP type introduced to handle dual IP stack UE capability.

Value: 2

PROTOCOL_IPV6

Added in API level 28
static val PROTOCOL_IPV6: Int

Internet protocol, version 6.

Value: 1

PROTOCOL_NON_IP

Added in API level 29
static val PROTOCOL_NON_IP: Int

Transfer of Non-IP data to external packet data network.

Value: 4

PROTOCOL_PPP

Added in API level 28
static val PROTOCOL_PPP: Int

Point to point protocol.

Value: 3

PROTOCOL_UNSTRUCTURED

Added in API level 29
static val PROTOCOL_UNSTRUCTURED: Int

Transfer of Unstructured data to the Data Network via N6.

Value: 5

TYPE_BIP

Added in API level 31
static val TYPE_BIP: Int

APN type for BIP.

Value: 8192

TYPE_CBS

Added in API level 28
static val TYPE_CBS: Int

APN type for CBS.

Value: 128

TYPE_DEFAULT

Added in API level 28
static val TYPE_DEFAULT: Int

APN type for default data traffic.

Value: 17

TYPE_DUN

Added in API level 28
static val TYPE_DUN: Int

APN type for DUN traffic.

Value: 8

TYPE_EMERGENCY

Added in API level 28
static val TYPE_EMERGENCY: Int

APN type for Emergency PDN. This is not an IA apn, but is used for access to carrier services in an emergency call situation.

Value: 512

TYPE_ENTERPRISE

Added in API level 33
static val TYPE_ENTERPRISE: Int

APN type for ENTERPRISE.

Value: 16384

TYPE_FOTA

Added in API level 28
static val TYPE_FOTA: Int

APN type for accessing the carrier's FOTA portal, used for over the air updates.

Value: 32

TYPE_HIPRI

Added in API level 28
static val TYPE_HIPRI: Int

APN type for HiPri traffic.

Value: 16

TYPE_IA

Added in API level 28
static val TYPE_IA: Int

APN type for IA Initial Attach APN.

Value: 256

TYPE_IMS

Added in API level 28
static val TYPE_IMS: Int

APN type for IMS.

Value: 64

TYPE_MCX

Added in API level 29
static val TYPE_MCX: Int

APN type for MCX (Mission Critical Service) where X can be PTT/Video/Data

Value: 1024

TYPE_MMS

Added in API level 28
static val TYPE_MMS: Int

APN type for MMS traffic.

Value: 2

TYPE_RCS

Added in API level 35
static val TYPE_RCS: Int

APN type for RCS (Rich Communication Services).

Value: 32768

TYPE_SUPL

Added in API level 28
static val TYPE_SUPL: Int

APN type for SUPL assisted GPS.

Value: 4

TYPE_VSIM

Added in API level 31
static val TYPE_VSIM: Int

APN type for VSIM.

Value: 4096

TYPE_XCAP

Added in API level 30
static val TYPE_XCAP: Int

APN type for XCAP.

Value: 2048

Public methods

describeContents

Added in API level 28
open fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

equals

Added in API level 28
open fun equals(other: Any?): Boolean
Parameters
obj the reference object with which to compare.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getApnName

Added in API level 28
open fun getApnName(): String!

Returns the name of the APN.

Return
String! APN name

getAuthType

Added in API level 28
open fun getAuthType(): Int

Returns the authentication type of the APN.

Return
Int authentication type Value is android.telephony.data.ApnSetting.AUTH_TYPE_UNKNOWN, android.telephony.data.ApnSetting#AUTH_TYPE_NONE, android.telephony.data.ApnSetting#AUTH_TYPE_PAP, android.telephony.data.ApnSetting#AUTH_TYPE_CHAP, or android.telephony.data.ApnSetting#AUTH_TYPE_PAP_OR_CHAP

getCarrierId

Added in API level 29
open fun getCarrierId(): Int

Returns the carrier id for this APN.

Return
Int the carrier id

getEntryName

Added in API level 28
open fun getEntryName(): String!

Gets the human-readable name that describes the APN.

Return
String! the entry name for the APN

getId

Added in API level 28
open fun getId(): Int

Returns the unique database id for this entry.

Return
Int the unique database id

getMmsProxyAddress

Added in API level 28
Deprecated in API level 29
open fun getMmsProxyAddress(): InetAddress!

Deprecated: use getMmsProxyAddressAsString() instead.

Gets the MMS proxy address configured for the APN. The MMS proxy address might be an IP address or hostname. This method returns null if system networking (typically DNS) isn’t available to resolve a hostname value—values set as IP addresses don’t have this restriction. This is a known problem and will be addressed in a future release.

Return
InetAddress! the MMS proxy address or null if DNS isn’t available to resolve a hostname

getMmsProxyAddressAsString

Added in API level 29
open fun getMmsProxyAddressAsString(): String!

Returns the MMS proxy address of the APN.

Return
String! MMS proxy address.

getMmsProxyPort

Added in API level 28
open fun getMmsProxyPort(): Int

Returns the MMS proxy port of the APN.

Return
Int MMS proxy port

getMmsc

Added in API level 28
open fun getMmsc(): Uri!

Returns the MMSC Uri of the APN.

Return
Uri! MMSC Uri.

getMtuV4

Added in API level 33
open fun getMtuV4(): Int

Returns the default MTU (Maximum Transmission Unit) size in bytes of the IPv4 routes brought up by this APN setting. Note this value will only be used when MTU size is not provided in DataCallResponse#getMtuV4() during network bring up.

Return
Int the MTU size in bytes of the route.

getMtuV6

Added in API level 33
open fun getMtuV6(): Int

Returns the MTU size of the IPv6 mobile interface to which the APN connected. Note this value will only be used when MTU size is not provided in DataCallResponse#getMtuV6() during network bring up.

Return
Int the MTU size in bytes of the route.

getMvnoType

Added in API level 28
open fun getMvnoType(): Int

Returns the MVNO match type for this APN.

Return
Int the MVNO match type Value is android.telephony.data.ApnSetting.MVNO_TYPE_UNKNOWN, android.telephony.data.ApnSetting#MVNO_TYPE_SPN, android.telephony.data.ApnSetting#MVNO_TYPE_IMSI, android.telephony.data.ApnSetting#MVNO_TYPE_GID, or android.telephony.data.ApnSetting#MVNO_TYPE_ICCID

getNetworkTypeBitmask

Added in API level 28
open fun getNetworkTypeBitmask(): Int

Returns a bitmask describing the Radio Technologies (Network Types) which this APN may use. NetworkType bitmask is calculated from NETWORK_TYPE defined in TelephonyManager. Examples of Network Types include TelephonyManager#NETWORK_TYPE_UNKNOWN, TelephonyManager#NETWORK_TYPE_GPRS, TelephonyManager#NETWORK_TYPE_EDGE.

Return
Int a bitmask describing the Radio Technologies (Network Types) or 0 if it is undefined.

getOperatorNumeric

Added in API level 28
open fun getOperatorNumeric(): String!

Returns the numeric operator ID for the APN. Numeric operator ID is defined as android.provider.Telephony.Carriers#MCC + android.provider.Telephony.Carriers#MNC.

Return
String! the numeric operator ID

getPassword

Added in API level 28
open fun getPassword(): String!

Returns the APN password of the APN.

Return
String! APN password

getProfileId

Added in API level 33
open fun getProfileId(): Int

Returns the profile id to which the APN saved in modem.

Return
Int the profile id of the APN

getProxyAddress

Added in API level 28
Deprecated in API level 29
open fun getProxyAddress(): InetAddress!

Deprecated: use getProxyAddressAsString() instead.

Gets the HTTP proxy address configured for the APN. The proxy address might be an IP address or hostname. This method returns null if system networking (typically DNS) isn’t available to resolve a hostname value—values set as IP addresses don’t have this restriction. This is a known problem and will be addressed in a future release.

Return
InetAddress! the HTTP proxy address or null if DNS isn’t available to resolve a hostname

getProxyAddressAsString

Added in API level 29
open fun getProxyAddressAsString(): String!

Returns the proxy address of the APN.

Return
String! proxy address.

getProxyPort

Added in API level 28
open fun getProxyPort(): Int

Returns the proxy address of the APN.

Return
Int proxy address.

getRoamingProtocol

Added in API level 28
open fun getRoamingProtocol(): Int

Returns the protocol to use to connect to this APN while the device is roaming.

Roaming protocol is one of the PDP_type values in TS 27.007 section 10.1.1.

Return
Int the roaming protocol Value is android.telephony.data.ApnSetting#PROTOCOL_IP, android.telephony.data.ApnSetting#PROTOCOL_IPV6, android.telephony.data.ApnSetting#PROTOCOL_IPV4V6, android.telephony.data.ApnSetting#PROTOCOL_PPP, android.telephony.data.ApnSetting#PROTOCOL_NON_IP, or android.telephony.data.ApnSetting#PROTOCOL_UNSTRUCTURED

getUser

Added in API level 28
open fun getUser(): String!

Returns the APN username of the APN.

Return
String! APN username

hashCode

Added in API level 28
open fun hashCode(): Int
Return
Int a hash code value for this object.

isAlwaysOn

Added in API level 35
open fun isAlwaysOn(): Boolean

Returns whether User Plane resources have to be activated during every transition from CM-IDLE mode to CM-CONNECTED state for this APN See 3GPP TS 23.501 section 5.6.13

Return
Boolean True if the PDU session for this APN should always be on and false otherwise

isEnabled

Added in API level 28
open fun isEnabled(): Boolean

Returns the current status of APN. true : enabled APN. false : disabled APN.

Return
Boolean the current status

isPersistent

Added in API level 33
open fun isPersistent(): Boolean

Returns if the APN setting is persistent on the modem.

Return
Boolean true if the APN setting is persistent on the modem.

writeToParcel

Added in API level 28
open fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 28
static val CREATOR: Parcelable.Creator<ApnSetting!>