I am trying to implement Firebase App Indexing, while the task to update the indexable is showing success and the index is also shown in the In Apps tab after searching in Google App. From what I understand, the index should also show up in the Auto Complete Suggestions when searching in the Google App but its not shown. I am following the tutorial from here . Following is the code snippet I am using to index the content:
Indexable menuItemToIndex = Indexables.noteDigitalDocumentBuilder()
.setName(title)
.setText(text)
.setUrl(link)
.build();
Task<Void> task = FirebaseAppIndex.getInstance().update(menuItemToIndex);
task.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
Log.d(TAG, "App index updated: " + title);
}
});
Also the version of the Firebase App Indexing library I'm using is
compile 'com.google.firebase:firebase-appindexing:10.0.1'
Is there anything I'm missing? I am testing on Nexus 6P running on Stock 7.1.1
and Google App version 6.9.36.21.arm64
.
Indexables need to be built with the Indexable.Builder , per item (which hints for a loop) ...while the DigitalDocumentBuilder is a rather specific implementation of it, especially for digital documents.
Indexable recipe = new Indexable.Builder()
.setName("Brownie Recipe")
.setUrl("//acme.com/recipes/12345678")
.build();
FirebaseAppIndex.getInstance().update(recipe);
check out the AppIndex documentation or
build and run the AppIndexing Quickstart :
git clone https://github.com/firebase/quickstart-android.git
.
further reading: Enabling Deep Links for App Content .
the tutorial (and the question) appears a little dated; the current version is 11.0.2
.
also com.google.android.gms
: play-services-appindexing
is required.
在更新了您已完成的项目之后,您还需要使用与更新项目相同的URL创建相应的视图操作,就像在配方应用程序中一样,然后它将自动完成。
FirebaseUserActions.getInstance().start(Actions.newView(item.getTitle(),"http://example.com/item?id=5"))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.