Message
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
欄位 |
kind (deprecated) |
string
標示資源的種類。值:固定字串 "walletobjects#walletObjectMessage" 。
|
body |
string
郵件內文。
|
displayInterval |
object (TimeInterval )
向使用者顯示訊息的時間範圍。您可以定義每則訊息的 startTime 和 endTime 。如果未設定 startTime ,訊息會在「錢包物件」插入後立即顯示。如未提供 endTime ,訊息會無限期顯示在訊息清單中。
|
id |
string
與訊息相關聯的 ID。這個欄位可方便您管理訊息。請注意,同一類別/例項中的不同訊息可能會有重複的 ID 值,請務必謹慎為每則訊息選取合理的 ID。
|
messageType |
enum (MessageType )
訊息類型。
|
localizedBody |
object (LocalizedString )
訊息內文的翻譯字串。
|
MessageType
列舉 |
MESSAGE_TYPE_UNSPECIFIED |
|
TEXT |
將訊息轉譯成文字並顯示於卡片資料畫面中。這是預設訊息類型。 |
text |
TEXT 的舊版別名,已淘汰。
|
EXPIRATION_NOTIFICATION |
注意:目前不支援這個列舉。 |
expirationNotification |
EXPIRATION_NOTIFICATION 的舊版別名,已淘汰。
|
TEXT_AND_NOTIFY |
將訊息轉譯成文字,以文字形式顯示在卡片資料畫面和 Android 通知中。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003eWallet Object Messages can be displayed to users with valuable content, including a header, body, and display interval.\u003c/p\u003e\n"],["\u003cp\u003eMessages can be customized with localized headers and bodies for different languages.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eMessageType\u003c/code\u003e determines how the message is rendered, with options for text display and Android notifications.\u003c/p\u003e\n"],["\u003cp\u003eEach message has a unique ID for management purposes, and a display interval can be set to control when it is shown.\u003c/p\u003e\n"]]],["The document outlines the structure of a message to be displayed, represented in JSON. Key fields include `header` and `body` for the message content, `displayInterval` to control visibility duration, and `id` for message management. `messageType` specifies how the message is displayed, with options like `TEXT` (default), or `TEXT_AND_NOTIFY`. Localized versions of the `header` and `body` are also supported.\n"],null,["# Message\n\n- [JSON representation](#SCHEMA_REPRESENTATION)\n- [MessageType](#MessageType)\n\nA message that will be displayed with a Valuable\n\n| JSON representation |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"kind\": string, \"header\": string, \"body\": string, \"displayInterval\": { object (/wallet/reference/rest/v1/TimeInterval) }, \"id\": string, \"messageType\": enum (/wallet/reference/rest/v1/Message#MessageType), \"localizedHeader\": { object (/wallet/reference/rest/v1/LocalizedString) }, \"localizedBody\": { object (/wallet/reference/rest/v1/LocalizedString) } } ``` |\n\n| Fields ||\n|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `kind` **(deprecated)** | `string` | This item is deprecated! Identifies what kind of resource this is. Value: the fixed string `\"walletobjects#walletObjectMessage\"`. |\n| `header` | `string` The message header. |\n| `body` | `string` The message body. |\n| `displayInterval` | `object (`[TimeInterval](/wallet/reference/rest/v1/TimeInterval)`)` The period of time that the message will be displayed to users. You can define both a `startTime` and `endTime` for each message. A message is displayed immediately after a Wallet Object is inserted unless a `startTime` is set. The message will appear in a list of messages indefinitely if `endTime` is not provided. |\n| `id` | `string` The ID associated with a message. This field is here to enable ease of management of messages. Notice ID values could possibly duplicate across multiple messages in the same class/instance, and care must be taken to select a reasonable ID for each message. |\n| `messageType` | `enum (`[MessageType](/wallet/reference/rest/v1/Message#MessageType)`)` The message type. |\n| `localizedHeader` | `object (`[LocalizedString](/wallet/reference/rest/v1/LocalizedString)`)` Translated strings for the message header. |\n| `localizedBody` | `object (`[LocalizedString](/wallet/reference/rest/v1/LocalizedString)`)` Translated strings for the message body. |\n\nMessageType\n-----------\n\n| Enums ||\n|----------------------------|-------------------------------------------------------------------------------------------|\n| `MESSAGE_TYPE_UNSPECIFIED` | |\n| `TEXT` | Renders the message as text on the card details screen. This is the default message type. |\n| `text` | Legacy alias for `TEXT`. Deprecated. | This item is deprecated! |\n| `EXPIRATION_NOTIFICATION` | Note: This enum is currently not supported. |\n| `expirationNotification` | Legacy alias for `EXPIRATION_NOTIFICATION`. Deprecated. | This item is deprecated! |\n| `TEXT_AND_NOTIFY` | Renders the message as text on the card details screen and as an Android notification. |"]]