NotificationCompat.MessagingStyle.Message
public final class NotificationCompat.MessagingStyle.Message
Summary
Public constructors |
|---|
Message(Creates a new |
This method is deprecated. Use the alternative constructor instead. |
Public methods |
|
|---|---|
@Nullable String |
Get the MIME type of the data pointed to by the URI. |
@Nullable Uri |
Get the the Uri pointing to the content of the message. |
@NonNull Bundle |
Get the extras Bundle for this message. |
@Nullable Person |
Returns the |
@Nullable CharSequence |
This method is deprecated. Use |
@Nullable 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 in ms since Unix epoch. |
@NonNull NotificationCompat.MessagingStyle.Message |
Sets a binary blob of data and an associated MIME type for a message. |
Public constructors
Message
public Message(
@Nullable CharSequence text,
long timestamp,
@Nullable Person person
)
Creates a new Message with the given text, timestamp, and sender.
| Parameters | |
|---|---|
@Nullable CharSequence text |
A |
long timestamp |
Time at which the message arrived in ms since Unix epoch |
@Nullable Person person |
A |
publicMessage(
@Nullable CharSequence text,
long timestamp,
@Nullable CharSequence sender
)
Constructor
| Parameters | |
|---|---|
@Nullable CharSequence text |
A |
long timestamp |
Time at which the message arrived in ms since Unix epoch |
@Nullable CharSequence sender |
A |
Public methods
getDataMimeType
public @Nullable String getDataMimeType()
Get the MIME type of the data pointed to by the URI.
getDataUri
public @Nullable Uri getDataUri()
Get the the Uri pointing to the content of the message. Can be null, in which case {@see #getText()} is used.
getPerson
public @Nullable Person getPerson()
Returns the Person sender of this message.
public @Nullable CharSequencegetSender()
Get the text used to display the contact's name in the messaging experience
getText
public @Nullable CharSequence getText()
Get the text to be used for this message, or the fallback text if a type and content Uri have been set
getTimestamp
public long getTimestamp()
Get the time at which this message arrived in ms since Unix epoch.
setData
public @NonNull NotificationCompat.MessagingStyle.Message setData(@Nullable String dataMimeType, @Nullable Uri dataUri)
Sets a binary blob of data and an associated MIME type for a message. In the case where the platform doesn't support the MIME type, the original text provided in the constructor will be used.
| Parameters | |
|---|---|
@Nullable String dataMimeType |
The MIME type of the content. See |
@Nullable Uri dataUri |
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:
|
| Returns | |
|---|---|
@NonNull NotificationCompat.MessagingStyle.Message |
this object for method chaining |