Common builders for Indexable objects

Message

This is an overview of the most important properties that should be specified by an app when indexing a message.

Property Description Example
url The URL linking to the message in the app. "myapp://messages/42"
name The subject line of the message, or directly the message itself, if it does not have a separate subject line. "Re: lunch"
text Optional. The body of the message, if applicable. For instant messaging type of messages without a separate subject line, use "name" (see above). "Are you free for lunch?"
dateReceived The time the message was received, for incoming messages. new Date(2016, 6, 2, 23, 43, 00)
dateSent The time the message was sent, for outgoing messages. new Date(2016, 6, 2, 23, 43, 00)
isPartOf.id An ID for the conversation or thread that the message is a part of. "42"
sender The sender of the message.
sender.name The name of the sender. "Alice"
sender.url Optional. The URL linking to the person in the app. "http://example.net/profiles/alice"
sender.image Optional. An image of the sender. Either a web URL or Content URI may be used. "http://example.net/alice.jpg"
sender.email Optional. The email address of the sender. "alice@example.net"
sender.telephone Optional. The phone number of the sender. "+16502530000"
sender.isSelf Indication of whether the user is the sender. The default is false. false
recipient One or multiple recipients of the message.
recipient.name The name of the recipient. "Bob"
recipient.url Optional. The URL linking to the person in the app. "http://example.net/profiles/bob"
recipient.image Optional. An image of the recipient. Either a web URL or Content URI may be used. "http://example.net/bob.jpg"
recipient.email Optional. The email address of the sender. "bob@example.net"
recipient.telephone Optional. The phone number of the sender. "+16502530000"
recipient.isSelf Indication of whether the user is the recipient. The default is false. true
messageAttachment Optional. One or multiple attachments to the message.
messageAttachment.name The name of the attachment to the message. "Sticker"
messageAttachment.image An image representing the attachment. Either a web URL or Content URI may be used. "http://example.net/stickers/23.png"

Example: Incoming message

Indexable message = Indexables.messageBuilder()
    .setUrl("myapp://messages/42")
    .setText("Are you free for lunch?")
    .setDateReceived(new Date(2016, 6, 2, 23, 44, 00))
    .setIsPartOf(Indexables.conversationBuilder().setId("42")
    .setSender(Indexables.personBuilder()
        .setName("Alice")
        .setImage("http://example.net/alice.jpg")
        .setEmail("alice@example.net")
        .setTelephone("+16502530000"))
    .setRecipient(Indexables.personBuilder()
        .setName("Bob")
        .setImage("http://example.net/bob.jpg")
        .setEmail("bob@people.net")
        .setTelephone("+16502530000")
        .setIsSelf(true))
    .build();
 

For email messages, use Indexables.emailMessageBuilder() instead. There is no difference in the supported fields, but the result UI will be different (e.g. highlighting the subject line of the email).

Note

This is an overview of the most important properties that should be specified by an app when indexing a note.

Property Description Example
url The URL linking to the note in the app. "myapp://notes/42"
name The title of the note, or directly the note text itself, if it does not have a separate title. "Shopping list"
text Optional. The text of the note, if applicable. For notes without a separate title, use "name" (see above). "steak, pasta, wine"
image An image representing the note. Either a web URL or Content URI may be used. "http://example.net/shopping.jpg"
dateCreated The creation time of the note. new Date(2016, 6, 2, 23, 43, 00)
author Optional. The author of the note.
author.name The name of the note's author. "Bob"

Example: Note

Indexable note = Indexables.noteDigitalDocumentBuilder()
    .setUrl("myapp://notes/42")
    .setName("Shopping list")
    .setText("steak, pasta, wine")
    .setImage("http://example.net/shopping.jpg")
    .setDateCreated(new Date(2016, 6, 2, 23, 43, 00))
    .build();

Send feedback about...

Need help? Visit our support page.