SubscriptionInfo
open class SubscriptionInfo : Parcelable
| kotlin.Any | |
| ↳ | android.telephony.SubscriptionInfo |
A Parcelable class for Subscription Information.
Summary
| Inherited constants | |
|---|---|
| Public methods | |
|---|---|
| open Bitmap! |
createIconBitmap(context: Context!)Creates and returns an icon |
| open Int |
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| open Boolean |
Indicates whether some other object is "equal to" this one. |
| open Int | |
| open Int | |
| open CharSequence! | |
| open String! | |
| open Int |
Whether user enables data roaming for this subscription or not. |
| open CharSequence! | |
| open ParcelUuid? |
Used in scenarios where different subscriptions are bundled as a group. |
| open String! |
getIccId()Returns the ICC ID. |
| open Int |
A highlight color to use in displaying information about this |
| open Int |
getMcc() |
| open String? | |
| open Int |
getMnc() |
| open String? | |
| open String! |
Returns the number of this subscription. |
| open Int | |
| open MutableSet<Int!> |
Retrieves the service capabilities for the current subscription. |
| open Int | |
| open Int | |
| open Int |
This method returns the type of a subscription. |
| open Int |
Get the usage setting for this subscription. |
| open Int |
hashCode()Returns a hash code value for the object. |
| open Boolean | |
| open Boolean |
Check if the subscription is exclusively for non-terrestrial networks. |
| open Boolean |
An opportunistic subscription connects to a network that is limited in functionality and / or coverage. |
| open String |
toString()Returns a string representation of the object. |
| open Unit |
writeToParcel(dest: Parcel, flags: Int)Flatten this object in to a Parcel. |
| Properties | |
|---|---|
| static Parcelable.Creator<SubscriptionInfo!> | |
Public methods
createIconBitmap
open fun createIconBitmap(context: Context!): Bitmap!
Creates and returns an icon Bitmap to represent this SubscriptionInfo in a user interface.
| Parameters | |
|---|---|
context |
Context!: A Context to get the DisplayMetricss from. |
| Return | |
|---|---|
Bitmap! |
A bitmap icon for this SubscriptionInfo. |
describeContents
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
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 returntrue. - It is symmetric: for any non-null reference values
xandy,x.equals(y)should returntrueif and only ify.equals(x)returnstrue. - It is transitive: for any non-null reference values
x,y, andz, ifx.equals(y)returnstrueandy.equals(z)returnstrue, thenx.equals(z)should returntrue. - It is consistent: for any non-null reference values
xandy, multiple invocations ofx.equals(y)consistently returntrueor consistently returnfalse, provided no information used inequalscomparisons on the objects is modified. - For any non-null reference value
x,x.equals(null)should returnfalse.
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. |
getCardId
open fun getCardId(): Int
| Return | |
|---|---|
Int |
The card ID of the SIM card which contains the subscription. |
getCarrierId
open fun getCarrierId(): Int
| Return | |
|---|---|
Int |
The carrier id of this subscription carrier. |
getCarrierName
open fun getCarrierName(): CharSequence!
| Return | |
|---|---|
CharSequence! |
The name displayed to the user that identifies subscription provider name. This name is the SPN displayed in status bar and many other places. Can't be renamed by the user. |
See Also
getCountryIso
open fun getCountryIso(): String!
| Return | |
|---|---|
String! |
The ISO country code. Empty if not available. |
getDataRoaming
open fun getDataRoaming(): Int
Whether user enables data roaming for this subscription or not. Either SubscriptionManager.DATA_ROAMING_ENABLE or SubscriptionManager.DATA_ROAMING_DISABLE.
getDisplayName
open fun getDisplayName(): CharSequence!
| Return | |
|---|---|
CharSequence! |
The name displayed to the user that identifies this subscription. This name is used in Settings page and can be renamed by the user. |
See Also
getGroupUuid
open fun getGroupUuid(): ParcelUuid?
Used in scenarios where different subscriptions are bundled as a group. It's typically a primary and an opportunistic subscription. (see isOpportunistic()) Such that those subscriptions will have some affiliated behaviors such as opportunistic subscription may be invisible to the user.
| Return | |
|---|---|
ParcelUuid? |
Group UUID a String of group UUID if it belongs to a group. Otherwise null. |
getIccId
open fun getIccId(): String!
Returns the ICC ID. Starting with API level 29 Security Patch 2021-04-05, returns the ICC ID if the calling app has been granted the READ_PRIVILEGED_PHONE_STATE permission, has carrier privileges (see TelephonyManager.hasCarrierPrivileges), or is a device owner or profile owner that has been granted the READ_PHONE_STATE permission. The profile owner is an app that owns a managed profile on the device; for more details see Work profiles. Profile owner access is deprecated and will be removed in a future release.
| Return | |
|---|---|
String! |
the ICC ID, or an empty string if one of these requirements is not met |
getIconTint
open fun getIconTint(): Int
A highlight color to use in displaying information about this PhoneAccount.
| Return | |
|---|---|
Int |
A hexadecimal color value. |
getMcc
open fungetMcc(): Int
Deprecated: Use getMccString() instead.
| Return | |
|---|---|
Int |
The mobile country code. |
getMccString
open fun getMccString(): String?
| Return | |
|---|---|
String? |
The mobile country code. This value may be null. |
getMnc
open fungetMnc(): Int
Deprecated: Use getMncString() instead.
| Return | |
|---|---|
Int |
The mobile network code. |
getMncString
open fun getMncString(): String?
| Return | |
|---|---|
String? |
The mobile network code. This value may be null. |
getNumber
open fungetNumber(): String!
Deprecated: use SubscriptionManager.getPhoneNumber(int) instead, which takes a subscription ID.
Returns the number of this subscription. Starting with API level 30, returns the number of this subscription if the calling app meets at least one of the following requirements:
- If the calling app's target SDK is API level 29 or lower and the app has been granted the READ_PHONE_STATE permission.
- If the calling app has been granted any of READ_PRIVILEGED_PHONE_STATE, READ_PHONE_NUMBERS, or READ_SMS.
- If the calling app has carrier privileges (see
TelephonyManager.hasCarrierPrivileges). - If the calling app is the default SMS role holder.
| Return | |
|---|---|
String! |
the number of this subscription, or an empty string if none of the requirements are met. |
getPortIndex
open fun getPortIndex(): Int
| Return | |
|---|---|
Int |
The port index of the SIM card which contains the subscription. |
getServiceCapabilities
open fun getServiceCapabilities(): MutableSet<Int!>
Retrieves the service capabilities for the current subscription.
These capabilities are hint to system components and applications, allowing them to enhance user experience. For instance, a Dialer application can inform the user that the current subscription is incapable of making voice calls if the voice service is not available.
Correct usage of these service capabilities must also consider the device's overall service capabilities. For example, even if the subscription supports voice calls, a voice call might not be feasible on a device that only supports data services. To determine the device's capabilities for voice and SMS services, refer to TelephonyManager#isDeviceVoiceCapable() and TelephonyManager#isDeviceSmsCapable().
Emergency service availability may not directly correlate with the subscription or device's general service capabilities. In some cases, emergency calls might be possible even if the subscription or device does not typically support voice services.
| Return | |
|---|---|
MutableSet<Int!> |
A set of integer representing the subscription's service capabilities, defined by SubscriptionManager#SERVICE_CAPABILITY_VOICE, SubscriptionManager#SERVICE_CAPABILITY_SMS and SubscriptionManager#SERVICE_CAPABILITY_DATA. This value cannot be null. Value is one of the following: |
See Also
android.telephony.TelephonyManager#isDeviceVoiceCapable()android.telephony.TelephonyManager#isDeviceSmsCapable()android.telephony.CarrierConfigManager#KEY_CELLULAR_SERVICE_CAPABILITIES_INT_ARRAYandroid.telephony.SubscriptionManager#SERVICE_CAPABILITY_VOICEandroid.telephony.SubscriptionManager#SERVICE_CAPABILITY_SMSandroid.telephony.SubscriptionManager#SERVICE_CAPABILITY_DATA
getSimSlotIndex
open fun getSimSlotIndex(): Int
| Return | |
|---|---|
Int |
The index of the SIM slot that currently contains the subscription and not necessarily unique and maybe SubscriptionManager.INVALID_SIM_SLOT_INDEX if unknown or the subscription is inactive. |
getSubscriptionId
open fun getSubscriptionId(): Int
| Return | |
|---|---|
Int |
The subscription ID. |
getSubscriptionType
open fun getSubscriptionType(): Int
This method returns the type of a subscription. It can be SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM or SubscriptionManager.SUBSCRIPTION_TYPE_REMOTE_SIM.
| Return | |
|---|---|
Int |
The type of the subscription. Value is one of the following: |
getUsageSetting
open fun getUsageSetting(): Int
Get the usage setting for this subscription.
| Return | |
|---|---|
Int |
The usage setting used for this subscription. Value is one of the following: |
hashCode
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
hashCodemethod must consistently return the same integer, provided no information used inequalscomparisons 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
equalsmethod, then calling thehashCodemethod 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
equalsmethod, then calling thehashCodemethod 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. |
isEmbedded
open fun isEmbedded(): Boolean
| Return | |
|---|---|
Boolean |
true if the subscription is from eSIM. |
isOnlyNonTerrestrialNetwork
open fun isOnlyNonTerrestrialNetwork(): Boolean
Check if the subscription is exclusively for non-terrestrial networks.
| Return | |
|---|---|
Boolean |
true if it is a non-terrestrial network subscription, false otherwise. |
isOpportunistic
open fun isOpportunistic(): Boolean
An opportunistic subscription connects to a network that is limited in functionality and / or coverage.
| Return | |
|---|---|
Boolean |
Whether subscription is opportunistic. |
toString
open fun toString(): String
Returns a string representation of the object.
| Return | |
|---|---|
String |
a string representation of the object. |
writeToParcel
open fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
Flatten this object in to a Parcel.
| Parameters | |
|---|---|
dest |
Parcel: The Parcel in which the object should be written. 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:
|