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 OEM_PAID networks (Automotive PANS)

static Int

APN type for OEM_PRIVATE networks (Automotive PANS)

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

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

open Boolean
equals(other: Any?)

Indicates whether some other object is "equal to" this one.

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

Returns a hash code value for the object.

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 String

Returns the string representation of ApnSetting.

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_OEM_PAID

Added in API level 36
static val TYPE_OEM_PAID: Int

APN type for OEM_PAID networks (Automotive PANS)

Value: 65536

TYPE_OEM_PRIVATE

Added in API level 36
static val TYPE_OEM_PRIVATE: Int

APN type for OEM_PRIVATE networks (Automotive PANS)

Value: 131072

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

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
Value is either 0 or

equals

Added in API level 28
open fun equals(other: Any?): Boolean

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

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

getApnTypeBitmask

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

Returns the bitmask of APN types.

Apn types are usage categories for an APN entry. One APN entry may support multiple APN types, eg, a single APN may service regular internet traffic ("default") as well as MMS-specific connections.

The bitmask of APN types is calculated from APN types defined in ApnSetting.

Return
Int a bitmask describing the types of the APN.
Value is either 0 or a combination of the following:

getAuthType

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

Returns the authentication type of the APN.

Return
Int authentication type.
Value is one of the following:

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 one of the following:

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

getProtocol

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

Returns the protocol to use to connect to this APN.

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

Return
Int the protocol.
Value is one of the following:

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 one of the following:

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

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
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.

toString

open fun toString(): String

Returns the string representation of ApnSetting. This method prints null for unset elements. The output doesn't contain password or user.

Return
String a string representation of the object.

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 the following:

Properties

CREATOR

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