# Print output for @column tags ?> SubscriptionInfo - Android SDK | Android Developers

Most visited

Recently visited

SubscriptionInfo

public class SubscriptionInfo
extends Object implements Parcelable

java.lang.Object
   ↳ android.telephony.SubscriptionInfo


A Parcelable class for Subscription Information.

Summary

Inherited constants

Fields

public static final Creator<SubscriptionInfo> CREATOR

Public methods

Bitmap createIconBitmap(Context context)

Creates and returns an icon Bitmap to represent this SubscriptionInfo in a user interface.

int describeContents()

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

boolean equals(Object obj)

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

int getCardId()

Returns the card ID of the SIM card which contains the subscription (see UiccCardInfo#getCardId().

int getCarrierId()
CharSequence getCarrierName()
String getCountryIso()
int getDataRoaming()
CharSequence getDisplayName()
ParcelUuid getGroupUuid()

Used in scenarios where different subscriptions are bundled as a group.

String getIccId()

Returns the ICC ID.

int getIconTint()

A highlight color to use in displaying information about this PhoneAccount.

int getMcc()

This method is deprecated. Use getMccString() instead.

String getMccString()
int getMnc()

This method is deprecated. Use getMncString() instead.

String getMncString()
String getNumber()

Returns the number of this subscription.

int getSimSlotIndex()
int getSubscriptionId()
int getSubscriptionType()

This method returns the type of a subscription.

int hashCode()

Returns a hash code value for the object.

boolean isEmbedded()
boolean isOpportunistic()

An opportunistic subscription connects to a network that is limited in functionality and / or coverage.

String toString()

Returns a string representation of the object.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Fields

CREATOR

public static final Creator<SubscriptionInfo> CREATOR

Public methods

createIconBitmap

public Bitmap createIconBitmap (Context context)

Creates and returns an icon Bitmap to represent this SubscriptionInfo in a user interface.

Parameters
context Context: A Context to get the DisplayMetricss from.

Returns
Bitmap A bitmap icon for this SubscriptionInfo.

describeContents

public int describeContents ()

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.

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

equals

public boolean equals (Object obj)

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.

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and y refer to the same object (x == y has the value true).

Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes.

Parameters
obj Object: the reference object with which to compare.

Returns
boolean true if this object is the same as the obj argument; false otherwise.

getCardId

public int getCardId ()

Returns the card ID of the SIM card which contains the subscription (see UiccCardInfo#getCardId().

Returns
int the cardId

getCarrierId

public int getCarrierId ()

Returns
int the carrier id of this Subscription carrier.

See also:

getCarrierName

public CharSequence getCarrierName ()

Returns
CharSequence the name displayed to the user that identifies Subscription provider name

getCountryIso

public String getCountryIso ()

Returns
String the ISO country code

getDataRoaming

public int getDataRoaming ()

Returns
int the data roaming state for this subscription, either SubscriptionManager#DATA_ROAMING_ENABLE or SubscriptionManager#DATA_ROAMING_DISABLE.

getDisplayName

public CharSequence getDisplayName ()

Returns
CharSequence the name displayed to the user that identifies this subscription

getGroupUuid

public ParcelUuid getGroupUuid ()

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.

Returns
ParcelUuid group UUID a String of group UUID if it belongs to a group. Otherwise it will return null.

getIccId

public String getIccId ()

Returns the ICC ID. Starting with API level 30, 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.

Returns
String the ICC ID, or an empty string if one of these requirements is not met

getIconTint

public int getIconTint ()

A highlight color to use in displaying information about this PhoneAccount.

Returns
int A hexadecimal color value.

getMcc

public int getMcc ()

This method is deprecated.
Use getMccString() instead.

Returns
int the MCC.

getMccString

public String getMccString ()

Returns
String The MCC, as a string. This value may be null.

getMnc

public int getMnc ()

This method is deprecated.
Use getMncString() instead.

Returns
int the MNC.

getMncString

public String getMncString ()

Returns
String The MNC, as a string. This value may be null.

getNumber

public String getNumber ()

Returns the number of this subscription. Starting with API level 30, returns the number of this subscription if the calling app meets 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.

Returns
String the number of this subscription, or an empty string if one of these requirements is not met

getSimSlotIndex

public int getSimSlotIndex ()

Returns
int the slot index of this Subscription's SIM card.

getSubscriptionId

public int getSubscriptionId ()

Returns
int the subscription ID.

getSubscriptionType

public int getSubscriptionType ()

This method returns the type of a subscription. It can be SubscriptionManager#SUBSCRIPTION_TYPE_LOCAL_SIM or SubscriptionManager#SUBSCRIPTION_TYPE_REMOTE_SIM.

Returns
int the type of subscription Value is SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM, or SubscriptionManager.SUBSCRIPTION_TYPE_REMOTE_SIM

hashCode

public int hashCode ()

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by 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(Object) 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(java.lang.Object) 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.

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the Java™ programming language.)

Returns
int a hash code value for this object.

isEmbedded

public boolean isEmbedded ()

Returns
boolean whether the subscription is an eUICC one.

isOpportunistic

public boolean isOpportunistic ()

An opportunistic subscription connects to a network that is limited in functionality and / or coverage.

Returns
boolean whether subscription is opportunistic.

toString

public String toString ()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
String a string representation of the object.

writeToParcel

public void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: The Parcel in which the object should be written.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES