我制作商品广告应用。我把所有产品都放到了Firebase。 但是创建商品搜索存在问题。我没有其他服务器而不是firebase。但是firebase for android中的查询太基础了 我的想法是使用Firebase Indexing for Google Search-Bot。我的想法是通过谷歌搜索搜索所有商品,如下所示:
但我也没有网站。
我在google示例中尝试了这个URL_BASE =" http://recipe-app.com/recipe/"
我将此添加到我的索引代码中:
//THIS IS NOT MY WEB-SITE, BECAUSE I HAVE NOT IT....
public static final String URL_BASE = "http://recipe-app.com/recipe/";
private void indexNote() {
// Note note = mRecipe.getNote();
Indexable noteToIndex = Indexables.noteDigitalDocumentBuilder()
.setName(titleEditText.getText().toString())
.setText("Added new product")
.setUrl(URL_BASE + "/product")
.build();
Task<Void> task = FirebaseAppIndex.getInstance().update(noteToIndex);
task.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(getActivity(), "", Toast.LENGTH_SHORT).show();
Log.d(MY_TAG, "App Indexing API: Successfully added note to index");
}
});
task.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
Log.e(MY_TAG, "App Indexing API: Failed to add note to index. " + exception
.getMessage());
}
});
}
将此添加到gradle:
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-appindexing:10.0.1'
这表明:
<intent-filter android:label="@string/app_name" android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "http://recipe-app.com/recipe" -->
<data android:scheme="http"
android:host="recipe-app.com"
android:pathPrefix="/recipe" />
</intent-filter>
但它不起作用。我正在尝试通过谷歌搜索搜索产品名称,因此我无法获得指向我应用的链接。 我究竟做错了什么?请有人帮忙。
答案 0 :(得分:1)
据我所知,你无法做到。基本上这个链接告诉系统,你的应用程序可以打开它们。但它们并不是真正的链接,它们甚至不需要引导您访问某个网站。同样,您无法从columnText.showTextAligned
制作search index
,因为它只是以其他方式运作。