Skip to content

Most visited

Recently visited

navigation

NotificationCompat.MessagingStyle.Message

public static final class NotificationCompat.MessagingStyle.Message
extends Object

java.lang.Object
   ↳ android.support.v4.app.NotificationCompat.MessagingStyle.Message


Summary

Public constructors

NotificationCompat.MessagingStyle.Message(CharSequence text, long timestamp, CharSequence sender)

Constructor

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.

CharSequence getSender()

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

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

From class java.lang.Object

Public constructors

NotificationCompat.MessagingStyle.Message

added in version 24.0.0
NotificationCompat.MessagingStyle.Message (CharSequence text, 
                long timestamp, 
                CharSequence sender)

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

Public methods

getDataMimeType

added in version 24.0.0
String getDataMimeType ()

Get the MIME type of the data pointed to by the Uri

Returns
String

getDataUri

added in version 24.0.0
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

added in version 26.0.0
Bundle getExtras ()

Get the extras Bundle for this message.

Returns
Bundle

getSender

added in version 24.0.0
CharSequence getSender ()

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

Returns
CharSequence

getText

added in version 24.0.0
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

added in version 24.0.0
long getTimestamp ()

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

Returns
long

setData

added in version 24.0.0
NotificationCompat.MessagingStyle.Message setData (String dataMimeType, 
                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
dataMimeType String: The MIME type of the content. See for the list of supported MIME types on Android and Android Wear.

dataUri Uri: The uri containing the content whose type is given by the MIME type.

  1. Notification Listeners including the System UI need permission to access the data the Uri points to. The recommended ways to do this are:
  2. Store the data in your own ContentProvider, making sure that other apps have the correct permission to access your provider. The preferred mechanism for providing access is to use per-URI permissions which are temporary and only grant access to the receiving application. An easy way to create a ContentProvider like this is to use the FileProvider helper class.
  3. Use the system MediaStore. The MediaStore is primarily aimed at video, audio and image MIME types, however beginning with Android 3.0 (API level 11) it can also store non-media types (see MediaStore.Files for more info). Files can be inserted into the MediaStore using scanFile() after which a content:// style Uri suitable for sharing is passed to the provided onScanCompleted() callback. Note that once added to the system MediaStore the content is accessible to any app on the device.

Returns
NotificationCompat.MessagingStyle.Message this object for method chaining

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)