# TextMessage

public final class **TextMessage** extends [Object](https://developer.android.com/reference/java/lang/Object.html)  
Represents a text message from a certain user in a conversation, providing context for
SmartReply to generate reply suggestions.

### Public Method Summary

|---|---|
| static [TextMessage](https://developers.google.com/android/reference/com/google/mlkit/nl/smartreply/TextMessage) | [createForLocalUser](https://developers.google.com/android/reference/com/google/mlkit/nl/smartreply/TextMessage#createForLocalUser(java.lang.String,%20long))([String](https://developer.android.com/reference/java/lang/String.html) messageText, long timestampMillis) Creates an instance of `https://developers.google.com/android/reference/com/google/mlkit/nl/smartreply/TextMessage` for a local user. |
| static [TextMessage](https://developers.google.com/android/reference/com/google/mlkit/nl/smartreply/TextMessage) | [createForRemoteUser](https://developers.google.com/android/reference/com/google/mlkit/nl/smartreply/TextMessage#createForRemoteUser(java.lang.String,%20long,%20java.lang.String))([String](https://developer.android.com/reference/java/lang/String.html) messageText, long timestampMillis, [String](https://developer.android.com/reference/java/lang/String.html) remoteUserId) Creates an instance of `https://developers.google.com/android/reference/com/google/mlkit/nl/smartreply/TextMessage` for a remote user. |

### Inherited Method Summary

From class java.lang.Object

|---|---|
| [Object](https://developer.android.com/reference/java/lang/Object.html) | clone() |
| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object.html) arg0) |
| void | finalize() |
| final [Class](https://developer.android.com/reference/java/lang/Class.html)\<?\> | getClass() |
| int | hashCode() |
| final void | notify() |
| final void | notifyAll() |
| [String](https://developer.android.com/reference/java/lang/String.html) | toString() |
| final void | wait(long arg0, int arg1) |
| final void | wait(long arg0) |
| final void | wait() |

## Public Methods

#### public static [TextMessage](https://developers.google.com/android/reference/com/google/mlkit/nl/smartreply/TextMessage)
**createForLocalUser** ([String](https://developer.android.com/reference/java/lang/String.html) messageText, long timestampMillis)

Creates an instance of `https://developers.google.com/android/reference/com/google/mlkit/nl/smartreply/TextMessage`
for a local user. The local user is the current user of the app's instance and is the
user for which SmartReply is generating a reply.

##### Parameters

| messageText | the message content. |
| timestampMillis | timestamp of the message in milliseconds since midnight, January 1, 1970 UTC. You can use, for example, `java.lang.System.currentTimeMillis()` to get the value. |
|---|---|

#### public static [TextMessage](https://developers.google.com/android/reference/com/google/mlkit/nl/smartreply/TextMessage)
**createForRemoteUser** ([String](https://developer.android.com/reference/java/lang/String.html) messageText, long timestampMillis, [String](https://developer.android.com/reference/java/lang/String.html) remoteUserId)

Creates an instance of `https://developers.google.com/android/reference/com/google/mlkit/nl/smartreply/TextMessage`
for a remote user. Your local user may have a conversation with one or more remote
users and providing context for messages your local user has received will help the API
generate smart replies.

##### Parameters

| messageText | the message content. |
| timestampMillis | timestamp of the message in milliseconds since midnight, January 1, 1970 UTC. You can use, for example, `java.lang.System.currentTimeMillis()` to get the value. |
| remoteUserId | a unique user ID representing a remote user if the local user is having a conversation with more than one remote user. It's only used to distinguish participants in the conversation. `https://developers.google.com/android/reference/com/google/mlkit/nl/smartreply/SmartReplyGenerator` is a stateless API, so there is no need to guarantee consistent user IDs across different API calls. |
|---|---|