【问题标题】:Android Firebase App indexing. Add to private index with custom schemeAndroid Firebase 应用索引。使用自定义方案添加到私有索引
【发布时间】:2017-03-09 12:29:01
【问题描述】:

我正在尝试使用 Firebase 应用索引来索引自定义用户内容。我做这样的事情:

Indexable indexable = new Indexable.Builder()
      .setUrl("custom_scheme://domain/path")
      .setName(title)
      .setDescription(description)
      .build();
FirebaseAppIndex.getInstance().update(indexable)

但如果我使用监听器跟踪更新任务,我会收到添加到索引错误。只需将自定义方案更改为 URI 的 http/https 方案即可。在这个应用程序中对我来说没问题。但是,如果我只想在没有正确 html url 的情况下索引我的应用程序私有内容,例如我没有网站。是否可以仅在 Google 应用中为 Firebase 应用索引使用自定义方案?

【问题讨论】:

    标签: android firebase-app-indexing


    【解决方案1】:

    我怀疑这是可能的。 App Indexing 本质上是将您相应的网站 URL 绑定到您的应用程序。这样您的网站就会被 Google 抓取并编入索引,并且可以出现在搜索结果中。如果您想保持您的内容私有且仅在设备的索引上可用,您可以将以下属性添加到您的 Indexable 对象:

    Indexable indexable = new Indexable.Builder()
      .setUrl("custom_scheme://domain/path")
      .setName(title)
      .setDescription(description)
      .setMetadata(new Action.Metadata.Builder().setUpload(false))
      .build();
    FirebaseAppIndex.getInstance().update(indexable)
    

    欲了解更多信息,您可以查看:https://firebase.google.com/docs/app-indexing/

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-05-05
    • 1970-01-01
    • 2010-11-30
    • 1970-01-01
    • 1970-01-01
    • 2023-03-05
    • 2015-03-08
    相关资源
    最近更新 更多