인덱싱 가능한 객체에 대한 공통 빌더

스티커

이는 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 선택 과목. 발신자의 이미지입니다. 웹 URL 또는 콘텐츠 URI를 사용할 수 있습니다. "http://example.net/alice.jpg"
sender.email 선택 과목. 보낸 사람의 이메일 주소입니다. "alice@example.net"
sender.telephone 선택 과목. 보내는 사람의 전화번호입니다. "+16502530000"
sender.isSelf 사용자가 보낸 사람인지 여부를 나타냅니다. 기본값은 거짓입니다. 거짓
recipient 메시지 수신자는 한 명 이상입니다.
recipient.name 수신자의 이름입니다. "단발"
recipient.url 선택 과목. 앱에 있는 사람과 연결되는 URL입니다. "http://example.net/profiles/bob"
recipient.image 선택 과목. 받는 사람의 이미지입니다. 웹 URL 또는 콘텐츠 URI를 사용할 수 있습니다. "http://example.net/bob.jpg"
recipient.email 선택 과목. 보낸 사람의 이메일 주소입니다. "bob@example.net"
recipient.telephone 선택 과목. 보내는 사람의 전화번호입니다. "+16502530000"
recipient.isSelf 사용자가 수신자인지 여부를 나타냅니다. 기본값은 거짓입니다. 진실
messageAttachment 선택 과목. 메시지에 대한 하나 이상의 첨부 파일입니다.
messageAttachment.name 메시지 첨부 파일의 이름입니다. "상표"
messageAttachment.image 첨부 파일을 나타내는 이미지입니다. 웹 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 메모를 표현한 이미지입니다. 웹 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();