Message
class Message
kotlin.Any | |
↳ | android.app.Notification.MessagingStyle.Message |
Summary
Public constructors | |
---|---|
Message(text: CharSequence!, timestamp: Long, sender: CharSequence!) Constructor |
|
Message(text: CharSequence, timestamp: Long, sender: Person?) Constructor |
Public methods | |
---|---|
String! |
Get the MIME type of the data pointed to by the Uri |
Uri! |
Get the Uri pointing to the content of the message. |
Bundle! |
Get the extras Bundle for this message. |
static MutableList<Notification.MessagingStyle.Message!> |
getMessagesFromBundleArray(bundles: Array<Parcelable!>?) Returns a list of messages read from the given bundle list, e. |
CharSequence! |
Get the text used to display the contact's name in the messaging experience |
Person? |
Get the sender associated with this message. |
CharSequence! |
getText() Get the text to be used for this message, or the fallback text if a type and content Uri have been set |
Long |
Get the time at which this message arrived |
Notification.MessagingStyle.Message! |
Sets a binary blob of data and an associated MIME type for a message. |
Public constructors
Message
Message(
text: CharSequence!,
timestamp: Long,
sender: CharSequence!)
Deprecated: use Message(CharSequence, long, Person)
Constructor
Parameters | |
---|---|
text |
CharSequence!: A CharSequence to be displayed as the message content |
timestamp |
Long: Time at which the message arrived |
sender |
CharSequence!: A CharSequence to be used for displaying the name of the sender. Should be null for messages by the current user, in which case the platform will insert MessagingStyle#getUserDisplayName() . Should be unique amongst all individuals in the conversation, and should be consistent during re-posts of the notification. |
Message
Message(
text: CharSequence,
timestamp: Long,
sender: Person?)
Constructor
Parameters | |
---|---|
text |
CharSequence: A CharSequence to be displayed as the message content This value cannot be null . |
timestamp |
Long: Time at which the message arrived |
sender |
Person?: The Person who sent the message. Should be null for messages by the current user, in which case the platform will insert the user set in MessagingStyle(Person) .
The person provided should contain an Icon, set with |
Public methods
getDataMimeType
fun getDataMimeType(): String!
Get the MIME type of the data pointed to by the Uri
getDataUri
fun getDataUri(): Uri!
Get the Uri pointing to the content of the message. Can be null, in which case {@see #getText()} is used.
getMessagesFromBundleArray
static fun getMessagesFromBundleArray(bundles: Array<Parcelable!>?): MutableList<Notification.MessagingStyle.Message!>
Returns a list of messages read from the given bundle list, e.g. EXTRA_MESSAGES
or EXTRA_HISTORIC_MESSAGES
.
Parameters | |
---|---|
bundles |
Array<Parcelable!>?: This value may be null . |
Return | |
---|---|
MutableList<Notification.MessagingStyle.Message!> |
This value cannot be null . |
getSender
fungetSender(): CharSequence!
Deprecated: use getSenderPerson()
Get the text used to display the contact's name in the messaging experience
getSenderPerson
fun getSenderPerson(): Person?
Get the sender associated with this message.
Return | |
---|---|
Person? |
This value may be null . |
getText
fun getText(): CharSequence!
Get the text to be used for this message, or the fallback text if a type and content Uri have been set
getTimestamp
fun getTimestamp(): Long
Get the time at which this message arrived
setData
fun setData(
dataMimeType: String!,
dataUri: Uri!
): Notification.MessagingStyle.Message!
Sets a binary blob of data and an associated MIME type for a message. In the case where the platform or the UI state doesn't support the MIME type, the original text provided in the constructor will be used. When this data can be presented to the user, the original text will only be used as accessibility text.
Parameters | |
---|---|
dataMimeType |
String!: The MIME type of the content. See android.graphics.ImageDecoder#isMimeTypeSupported(String) for a list of supported image MIME types. |
dataUri |
Uri!: The uri containing the content whose type is given by the MIME type.
Notification Listeners including the System UI need permission to access the data the Uri points to. The recommended ways to do this are:
|
Return | |
---|---|
Notification.MessagingStyle.Message! |
this object for method chaining |