# NotificationCompat.MessagingStyle.Message

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1  
Summary:[Ctors](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message#pubctors)\|[Methods](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message#)  

# NotificationCompat.MessagingStyle.Message

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public
static
final

class
NotificationCompat.MessagingStyle.Message
`  
`

extends Object


``


`

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

<br />

*** ** * ** ***

## Summary

|                                                                                                                                                      ### Public constructors                                                                                                                                                       ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[NotificationCompat.MessagingStyle.Message](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message#NotificationCompat.MessagingStyle.Message(java.lang.CharSequence, long, java.lang.CharSequence))`(CharSequence text, long timestamp, CharSequence sender) ` Constructor |

|                                                                                                                                                                                                                                            ### Public methods                                                                                                                                                                                                                                            ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` String`                                                                                                                                                | ` `[getDataMimeType](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message#getDataMimeType())`() ` Get the MIME type of the data pointed to by the Uri                                                                                                                                      |
| ` `[Uri](https://developer.android.com/reference/android/net/Uri.html)                                                                                   | ` `[getDataUri](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message#getDataUri())`() ` Get the the Uri pointing to the content of the message.                                                                                                                                            |
| ` `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)                                                                              | ` `[getExtras](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message#getExtras())`() ` Get the extras Bundle for this message.                                                                                                                                                              |
| ` CharSequence`                                                                                                                                          | ` `[getSender](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message#getSender())`() ` Get the text used to display the contact's name in the messaging experience                                                                                                                          |
| ` CharSequence`                                                                                                                                          | ` `[getText](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message#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](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message#getTimestamp())`() ` Get the time at which this message arrived in ms since Unix epoch                                                                                                                              |
| ` `[NotificationCompat.MessagingStyle.Message](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message) | ` `[setData](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message#setData(java.lang.String, android.net.Uri))`(String dataMimeType, `[Uri](https://developer.android.com/reference/android/net/Uri.html)` dataUri) ` Sets a binary blob of data and an associated MIME type for a message. |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Public constructors

### NotificationCompat.MessagingStyle.Message

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

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

Constructor

<br />

|                                                                                                                                                                                                                                                               Parameters                                                                                                                                                                                                                                                               ||
|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `text`      | `CharSequence`: A[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)to be displayed as the message content <br />                                                                                                                                                                                                                                                                                                                                                                              |
| `timestamp` | `long`: Time at which the message arrived in ms since Unix epoch <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `sender`    | `CharSequence`: A[CharSequence](https://developer.android.com/reference/java/lang/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()](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle#getUserDisplayName()). Should be unique amongst all individuals in the conversation, and should be consistent during re-posts of the notification. <br /> |

## Public methods

### getDataMimeType

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
String getDataMimeType ()
```

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

<br />

|     Returns      ||
|----------|--------|
| `String` | <br /> |

### getDataUri

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Uri getDataUri ()
```

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

<br />

|                                   Returns                                   ||
|---------------------------------------------------------------------|--------|
| [Uri](https://developer.android.com/reference/android/net/Uri.html) | <br /> |

**See also:**

- [getText()](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message#getText())  

### getExtras

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Bundle getExtras ()
```

Get the extras Bundle for this message.

<br />

|                                     Returns                                      ||
|--------------------------------------------------------------------------|--------|
| [Bundle](https://developer.android.com/reference/android/os/Bundle.html) | <br /> |

### getSender

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
CharSequence getSender ()
```

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

<br />

|        Returns         ||
|----------------|--------|
| `CharSequence` | <br /> |

### getText

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
CharSequence getText ()
```

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

<br />

|        Returns         ||
|----------------|--------|
| `CharSequence` | <br /> |

### getTimestamp

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long getTimestamp ()
```

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

<br />

|    Returns     ||
|--------|--------|
| `long` | <br /> |

### setData

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
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.

<br />

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ||
|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `dataMimeType` | `String`: The MIME type of the content. See[for the list of supported MIME types on Android and Android Wear. <br />](https://developer.android.com/notifications/messaging)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `dataUri`      | `Uri`: The uri containing the content whose type is given by the MIME type. <br /> 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. <br /> |

|                                                                                            Returns                                                                                            ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|
| [NotificationCompat.MessagingStyle.Message](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message) | this object for method chaining <br /> |

-

  ## Annotations

  - [NotificationCompat.Action.SemanticAction](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action.SemanticAction)
-

  ## Interfaces

  - [ActionBarDrawerToggle.Delegate](https://developer.android.com/reference/android/support/v4/app/ActionBarDrawerToggle.Delegate)
  - [ActionBarDrawerToggle.DelegateProvider](https://developer.android.com/reference/android/support/v4/app/ActionBarDrawerToggle.DelegateProvider)
  - [ActivityCompat.OnRequestPermissionsResultCallback](https://developer.android.com/reference/android/support/v4/app/ActivityCompat.OnRequestPermissionsResultCallback)
  - [ActivityCompat.PermissionCompatDelegate](https://developer.android.com/reference/android/support/v4/app/ActivityCompat.PermissionCompatDelegate)
  - [FragmentManager.BackStackEntry](https://developer.android.com/reference/android/support/v4/app/FragmentManager.BackStackEntry)
  - [FragmentManager.OnBackStackChangedListener](https://developer.android.com/reference/android/support/v4/app/FragmentManager.OnBackStackChangedListener)
  - [LoaderManager.LoaderCallbacks](https://developer.android.com/reference/android/support/v4/app/LoaderManager.LoaderCallbacks)
  - [NotificationCompat.Action.Extender](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action.Extender)
  - [NotificationCompat.Extender](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Extender)
  - [SharedElementCallback.OnSharedElementsReadyListener](https://developer.android.com/reference/android/support/v4/app/SharedElementCallback.OnSharedElementsReadyListener)
  - [TaskStackBuilder.SupportParentable](https://developer.android.com/reference/android/support/v4/app/TaskStackBuilder.SupportParentable)
-

  ## Classes

  - [ActionBarDrawerToggle](https://developer.android.com/reference/android/support/v4/app/ActionBarDrawerToggle)
  - [ActivityCompat](https://developer.android.com/reference/android/support/v4/app/ActivityCompat)
  - [ActivityManagerCompat](https://developer.android.com/reference/android/support/v4/app/ActivityManagerCompat)
  - [ActivityOptionsCompat](https://developer.android.com/reference/android/support/v4/app/ActivityOptionsCompat)
  - [AlarmManagerCompat](https://developer.android.com/reference/android/support/v4/app/AlarmManagerCompat)
  - [AppLaunchChecker](https://developer.android.com/reference/android/support/v4/app/AppLaunchChecker)
  - [AppOpsManagerCompat](https://developer.android.com/reference/android/support/v4/app/AppOpsManagerCompat)
  - [BundleCompat](https://developer.android.com/reference/android/support/v4/app/BundleCompat)
  - [DialogFragment](https://developer.android.com/reference/android/support/v4/app/DialogFragment)
  - [Fragment](https://developer.android.com/reference/android/support/v4/app/Fragment)
  - [Fragment.SavedState](https://developer.android.com/reference/android/support/v4/app/Fragment.SavedState)
  - [FragmentActivity](https://developer.android.com/reference/android/support/v4/app/FragmentActivity)
  - [FragmentContainer](https://developer.android.com/reference/android/support/v4/app/FragmentContainer)
  - [FragmentController](https://developer.android.com/reference/android/support/v4/app/FragmentController)
  - [FragmentHostCallback](https://developer.android.com/reference/android/support/v4/app/FragmentHostCallback)
  - [FragmentManager](https://developer.android.com/reference/android/support/v4/app/FragmentManager)
  - [FragmentManager.FragmentLifecycleCallbacks](https://developer.android.com/reference/android/support/v4/app/FragmentManager.FragmentLifecycleCallbacks)
  - [FragmentManagerNonConfig](https://developer.android.com/reference/android/support/v4/app/FragmentManagerNonConfig)
  - [FragmentPagerAdapter](https://developer.android.com/reference/android/support/v4/app/FragmentPagerAdapter)
  - [FragmentStatePagerAdapter](https://developer.android.com/reference/android/support/v4/app/FragmentStatePagerAdapter)
  - [FragmentTabHost](https://developer.android.com/reference/android/support/v4/app/FragmentTabHost)
  - [FragmentTransaction](https://developer.android.com/reference/android/support/v4/app/FragmentTransaction)
  - [FrameMetricsAggregator](https://developer.android.com/reference/android/support/v4/app/FrameMetricsAggregator)
  - [JobIntentService](https://developer.android.com/reference/android/support/v4/app/JobIntentService)
  - [ListFragment](https://developer.android.com/reference/android/support/v4/app/ListFragment)
  - [LoaderManager](https://developer.android.com/reference/android/support/v4/app/LoaderManager)
  - [NavUtils](https://developer.android.com/reference/android/support/v4/app/NavUtils)
  - [NotificationCompat](https://developer.android.com/reference/android/support/v4/app/NotificationCompat)
  - [NotificationCompat.Action](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action)
  - [NotificationCompat.Action.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action.Builder)
  - [NotificationCompat.Action.WearableExtender](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action.WearableExtender)
  - [NotificationCompat.BigPictureStyle](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.BigPictureStyle)
  - [NotificationCompat.BigTextStyle](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.BigTextStyle)
  - [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder)
  - [NotificationCompat.CarExtender](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.CarExtender)
  - [NotificationCompat.CarExtender.UnreadConversation](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.CarExtender.UnreadConversation)
  - [NotificationCompat.CarExtender.UnreadConversation.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.CarExtender.UnreadConversation.Builder)
  - [NotificationCompat.DecoratedCustomViewStyle](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.DecoratedCustomViewStyle)
  - [NotificationCompat.InboxStyle](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.InboxStyle)
  - [NotificationCompat.MessagingStyle](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle)
  - [NotificationCompat.MessagingStyle.Message](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message)
  - [NotificationCompat.Style](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Style)
  - [NotificationCompat.WearableExtender](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.WearableExtender)
  - [NotificationCompatExtras](https://developer.android.com/reference/android/support/v4/app/NotificationCompatExtras)
  - [NotificationCompatSideChannelService](https://developer.android.com/reference/android/support/v4/app/NotificationCompatSideChannelService)
  - [NotificationManagerCompat](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat)
  - [RemoteInput](https://developer.android.com/reference/android/support/v4/app/RemoteInput)
  - [RemoteInput.Builder](https://developer.android.com/reference/android/support/v4/app/RemoteInput.Builder)
  - [ServiceCompat](https://developer.android.com/reference/android/support/v4/app/ServiceCompat)
  - [ShareCompat](https://developer.android.com/reference/android/support/v4/app/ShareCompat)
  - [ShareCompat.IntentBuilder](https://developer.android.com/reference/android/support/v4/app/ShareCompat.IntentBuilder)
  - [ShareCompat.IntentReader](https://developer.android.com/reference/android/support/v4/app/ShareCompat.IntentReader)
  - [SharedElementCallback](https://developer.android.com/reference/android/support/v4/app/SharedElementCallback)
  - [TaskStackBuilder](https://developer.android.com/reference/android/support/v4/app/TaskStackBuilder)
-

  ## Exceptions

  - [Fragment.InstantiationException](https://developer.android.com/reference/android/support/v4/app/Fragment.InstantiationException)