贴纸
这是对贴纸或贴纸包进行索引以与 Gboard 集成时要包含的最重要属性的概述。有关示例,请参阅 Github 上的App Indexing 示例。
财产 | 描述 | 例子 |
---|---|---|
name | 用于搜索的名称或关键字 - 不显示。 | “史努比贴纸包” |
url | 链接到应用程序中的贴纸或贴纸包的 URL。 | “http://sticker/pack/canonical/url/snoopy” |
image | 贴纸或贴纸包图形。为了获得最佳图像质量,请使用大小为 320 像素或 500 像素的方形图像。 | “http://link/to/the/image/bye” |
description | 贴纸或贴纸包的辅助功能标签。 | “史努比贴纸一包” |
示例:贴纸包
// Build and index the sticker objects on first run after update or install // to minimize lag between sticker install and stickers surfacing in Gboard. FirebaseAppIndex.update(new Indexable.Builder("StickerPack") .setName("Snoopy Pack") .setImage("content://sticker/pack/canonical/image") // see: Support links to your app content section .setUrl("http://sticker/pack/canonical/url/snoopy") // Set the accessibility label for the sticker pack. .setDescription("A sticker pack of Snoopy") .put("hasSticker", new Indexable.Builder("Sticker") .setName("Hey") .setImage("http://link/to/the/image/hey") .setDescription("A Snoopy hey sticker.") .build(), new Indexable.Builder("Sticker") .setName("Bye") .setImage("http://link/to/the/image/bye") .setDescription("A Snoopy bye sticker.") .build()) .build());
示例:个人贴纸
Indexable[] stickers = new Indexable[]{ new Indexable.Builder("Sticker") .setName("Hey") .setImage("http://www.snoopysticker.com?id=1234") // see: Support links to your app content section .setUrl("http://sticker/canonical/image/hey") // Set the accessibility label for the sticker. .setDescription("A sticker for hi") // Add search keywords. .put("keywords", "hey", "snoopy", "hi", "hello") .put("isPartOf", new Indexable.Builder("StickerPack") .setName("Snoopy Pack")) .build()) .build()), new Indexable.Builder("Sticker") .setName("Bye") .setImage("http://www.snoopysticker.com?id=4567") // see: Support links to your app content section .setUrl("http://sticker/canonical/image/bye") // Set the accessibility label for the sticker. .setDescription("A sticker for Bye") // Add search keywords. .put("keywords", "bye", "snoopy", "see ya", "good bye") .put("isPartOf", new Indexable.Builder("StickerPack") .setName("Snoopy Pack") .build()) .build())}; // Make sure we update stickers in batch FirebaseAppIndex.update(stickers);
信息
这是应用程序在对消息建立索引时应指定的最重要属性的概述。
财产 | 描述 | 例子 |
---|---|---|
url | 链接到应用程序中消息的 URL。 | “myapp://messages/42” |
name | 邮件的主题行,或者直接是邮件本身(如果没有单独的主题行)。 | “回复:午餐” |
text | 选修的。消息正文(如果适用)。对于没有单独主题行的即时消息类型的消息,请使用“名称”(见上文)。 | “你有空吃午饭吗?” |
dateReceived | 对于传入消息,收到消息的时间。 | 新日期(2016, 6, 2, 23, 43, 00) |
dateSent | 发送消息的时间(对于传出消息)。 | 新日期(2016, 6, 2, 23, 43, 00) |
isPartOf.id | 消息所属的对话或线程的 ID。 | “42” |
sender | 消息的发送者。 | |
sender.name | 发件人的姓名。 | “爱丽丝” |
sender.url | 选修的。链接到应用程序中的人员的 URL。 | “http://example.net/profiles/alice” |
sender.image | 选修的。发件人的图像。可以使用 Web URL 或内容 URI。 | “http://example.net/alice.jpg” |
sender.email | 选修的。发件人的电子邮件地址。 | “alice@example.net” |
sender.telephone | 选修的。发件人的电话号码。 | “+16502530000” |
sender.isSelf | 指示用户是否是发件人。默认为 false。 | 错误的 |
recipient | 消息的一个或多个收件人。 | |
recipient.name | 收件人姓名。 | “鲍勃” |
recipient.url | 选修的。链接到应用程序中的人员的 URL。 | “http://example.net/profiles/bob” |
recipient.image | 选修的。收件人的图像。可以使用 Web URL 或内容 URI。 | “http://example.net/bob.jpg” |
recipient.email | 选修的。发件人的电子邮件地址。 | “鲍勃@example.net” |
recipient.telephone | 选修的。发件人的电话号码。 | “+16502530000” |
recipient.isSelf | 指示用户是否是收件人。默认为 false。 | 真的 |
messageAttachment | 选修的。邮件的一个或多个附件。 | |
messageAttachment.name | 邮件附件的名称。 | “贴纸” |
messageAttachment.image | 代表附件的图像。可以使用 Web URL 或内容 URI。 | “http://example.net/stickers/23.png” |
示例:传入消息
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();
对于电子邮件消息,请使用Indexables.emailMessageBuilder()
代替。支持的字段没有区别,但结果 UI 会有所不同(例如突出显示电子邮件的主题行)。
笔记
这是应用程序在为笔记建立索引时应指定的最重要属性的概述。
财产 | 描述 | 例子 |
---|---|---|
url | 链接到应用程序中的注释的 URL。 | “myapp://notes/42” |
name | 注释的标题,或者直接注释文本本身(如果没有单独的标题)。 | “购物清单” |
text | 选修的。注释的文本(如果适用)。对于没有单独标题的注释,请使用“名称”(见上文)。 | “牛排、面食、葡萄酒” |
image | 代表注释的图像。可以使用 Web URL 或内容 URI。 | “http://example.net/shopping.jpg” |
dateCreated | 笔记的创建时间。 | 新日期(2016, 6, 2, 23, 43, 00) |
author | 选修的。笔记的作者。 | |
author.name | 笔记作者的姓名。 | “鲍勃” |
示例:注释
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();