WalletCard

public final class WalletCard
extends Object implements Parcelable

java.lang.Object
   ↳ android.service.quickaccesswallet.WalletCard


A WalletCard can represent anything that a user might carry in their wallet -- a credit card, library card, transit pass, etc. Cards are identified by a String identifier and contain a card type, card image, card image content description, and a PendingIntent to be used if the user clicks on the card. Cards may be displayed with an icon and label, though these are optional. Non-payment cards will also have a second image that will be displayed when the card is tapped.

Summary

Nested classes

class WalletCard.Builder

Builder for WalletCard objects. 

Constants

int CARD_TYPE_NON_PAYMENT

Non-payment cards refer to any cards that are not used for cash-equivalent payment, including event tickets, flights, offers, loyalty cards, gift cards and transit tickets.

int CARD_TYPE_PAYMENT

Payment cards refer to credit cards, debit cards or any other cards in the wallet used to make cash-equivalent payments.

int CARD_TYPE_UNKNOWN

Unknown cards refer to cards whose types are unspecified.

Inherited constants

Fields

public static final Creator<WalletCard> CREATOR

Public methods

int describeContents()

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

Icon getCardIcon()

An icon may be shown alongside the card image to convey information about how the card can be used, or if some other action must be taken before using the card.

String getCardId()

The card id must be unique within the list of cards returned.

Icon getCardImage()

The visual representation of the card.

CharSequence getCardLabel()

A card label may be shown alongside the card image to convey information about how the card can be used, or if some other action must be taken before using the card.

List<Location> getCardLocations()

List of locations that this card might be useful at.

int getCardType()

Returns the card type.

CharSequence getContentDescription()

The content description of the card image.

Icon getNonPaymentCardSecondaryImage()

Visual representation of the card when it is tapped.

PendingIntent getPendingIntent()

If the user performs a click on the card, this PendingIntent will be sent.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

CARD_TYPE_NON_PAYMENT

Added in API level 34
public static final int CARD_TYPE_NON_PAYMENT

Non-payment cards refer to any cards that are not used for cash-equivalent payment, including event tickets, flights, offers, loyalty cards, gift cards and transit tickets.

Constant Value: 2 (0x00000002)

CARD_TYPE_PAYMENT

Added in API level 34
public static final int CARD_TYPE_PAYMENT

Payment cards refer to credit cards, debit cards or any other cards in the wallet used to make cash-equivalent payments.

Constant Value: 1 (0x00000001)

CARD_TYPE_UNKNOWN

Added in API level 34
public static final int CARD_TYPE_UNKNOWN

Unknown cards refer to cards whose types are unspecified.

Constant Value: 0 (0x00000000)

Fields

CREATOR

Added in API level 30
public static final Creator<WalletCard> CREATOR

Public methods

describeContents

Added in API level 30
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

getCardIcon

Added in API level 30
public Icon getCardIcon ()

An icon may be shown alongside the card image to convey information about how the card can be used, or if some other action must be taken before using the card. For example, an NFC logo could indicate that the card is NFC-enabled and will be provided to an NFC terminal if the phone is held in close proximity to the NFC reader.

If the supplied Icon is backed by a bitmap, it should have width and height GetWalletCardsRequest#getIconSizePx().

Returns
Icon This value may be null.

getCardId

Added in API level 30
public String getCardId ()

The card id must be unique within the list of cards returned.

Returns
String This value cannot be null.

getCardImage

Added in API level 30
public Icon getCardImage ()

The visual representation of the card. If the card image Icon is a bitmap, it should have a width of GetWalletCardsRequest#getCardWidthPx() and a height of GetWalletCardsRequest.getCardHeightPx().

Returns
Icon This value cannot be null.

getCardLabel

Added in API level 30
public CharSequence getCardLabel ()

A card label may be shown alongside the card image to convey information about how the card can be used, or if some other action must be taken before using the card. For example, an NFC-enabled card could be labeled "Hold near reader" to inform the user of how to use NFC cards when interacting with an NFC reader.

If the provided label is too long to fit on one line, it may be truncated and ellipsized.

Returns
CharSequence This value may be null.

getCardLocations

Added in API level 34
public List<Location> getCardLocations ()

List of locations that this card might be useful at.

Returns
List<Location> This value cannot be null.

getCardType

Added in API level 34
public int getCardType ()

Returns the card type.

Returns
int This value cannot be null. Value is CARD_TYPE_UNKNOWN, CARD_TYPE_PAYMENT, or CARD_TYPE_NON_PAYMENT

getContentDescription

Added in API level 30
public CharSequence getContentDescription ()

The content description of the card image.

Returns
CharSequence This value cannot be null.

getNonPaymentCardSecondaryImage

Added in API level 34
public Icon getNonPaymentCardSecondaryImage ()

Visual representation of the card when it is tapped. May include additional information unique to the card, such as a barcode or number. Only valid for CARD_TYPE_NON_PAYMENT.

Returns
Icon This value may be null.

getPendingIntent

Added in API level 30
public PendingIntent getPendingIntent ()

If the user performs a click on the card, this PendingIntent will be sent. If the device is locked, the wallet will first request device unlock before sending the pending intent.

Returns
PendingIntent This value cannot be null.

writeToParcel

Added in API level 30
public void writeToParcel (Parcel dest, 
                int flags)

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.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES