NotificationCompat.MessagingStyle.Message

public static final class NotificationCompat.MessagingStyle.Message
extends Object

java.lang.Object
   ↳ androidx.core.app.NotificationCompat.MessagingStyle.Message


Summary

Public constructors

Message(CharSequence text, long timestamp, Person person)

Creates a new NotificationCompat.MessagingStyle.Message with the given text, timestamp, and sender.

Message(CharSequence text, long timestamp, CharSequence sender)

This constructor is deprecated. Use the alternative constructor instead.

Public methods

String getDataMimeType()

Get the MIME type of the data pointed to by the URI.

Uri getDataUri()

Get the the Uri pointing to the content of the message.

Bundle getExtras()

Get the extras Bundle for this message.

Person getPerson()

Returns the Person sender of this message.

CharSequence getSender()

This method is deprecated. Use getPerson()

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 getTimestamp()

Get the time at which this message arrived in ms since Unix epoch.

NotificationCompat.MessagingStyle.Message setData(String dataMimeType, Uri dataUri)

Sets a binary blob of data and an associated MIME type for a message.

Inherited methods

Public constructors

Message

public Message (CharSequence text, 
                long timestamp, 
                Person person)

Creates a new NotificationCompat.MessagingStyle.Message with the given text, timestamp, and sender.

Parameters
text CharSequence: A CharSequence to be displayed as the message content

timestamp long: Time at which the message arrived in ms since Unix epoch

person Person: A Person whose Person.getName() value is used as the display name for the sender. This should be null for messages by the current user, in which case, the platform will insert NotificationCompat.MessagingStyle.getUserDisplayName(). A Person's key should be consistent during re-posts of the notification.

Message

public Message (CharSequence text, 
                long timestamp, 
                CharSequence sender)

This constructor is deprecated.
Use the alternative constructor instead.

Constructor

Parameters
text CharSequence: A CharSequence to be displayed as the message content

timestamp long: Time at which the message arrived in ms since Unix epoch

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 NotificationCompat.MessagingStyle.getUserDisplayName(). Should be unique amongst all individuals in the conversation, and should be consistent during re-posts of the notification.

Public methods

getDataMimeType

public String getDataMimeType ()

Get the MIME type of the data pointed to by the URI.

Returns
String

getDataUri

public Uri getDataUri ()

Get the the Uri pointing to the content of the message. Can be null, in which case is used.

Returns
Uri

See also:

getExtras

public Bundle getExtras ()

Get the extras Bundle for this message.

Returns
Bundle

getPerson

public Person getPerson ()

Returns the Person sender of this message.

Returns
Person

getSender

public CharSequence getSender ()

This method is deprecated.
Use getPerson()

Get the text used to display the contact's name in the messaging experience

Returns
CharSequence

getText

public CharSequence getText ()

Get the text to be used for this message, or the fallback text if a type and content Uri have been set

Returns
CharSequence

getTimestamp

public long getTimestamp ()

Get the time at which this message arrived in ms since Unix epoch.

Returns
long

setData