• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FirebaseAppIndex类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.firebase.appindexing.FirebaseAppIndex的典型用法代码示例。如果您正苦于以下问题:Java FirebaseAppIndex类的具体用法?Java FirebaseAppIndex怎么用?Java FirebaseAppIndex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FirebaseAppIndex类属于com.google.firebase.appindexing包,在下文中一共展示了FirebaseAppIndex类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: clearStickers

import com.google.firebase.appindexing.FirebaseAppIndex; //导入依赖的package包/类
public static void clearStickers(final Context context, FirebaseAppIndex firebaseAppIndex) {
    Task<Void> task = firebaseAppIndex.removeAll();

    task.addOnSuccessListener(new OnSuccessListener<Void>() {
        @Override
        public void onSuccess(Void aVoid) {
            Toast.makeText(context, "Successfully cleared stickers", Toast.LENGTH_SHORT).show();
        }
    });
    task.addOnFailureListener(new OnFailureListener() {
        @Override
        public void onFailure(@NonNull Exception e) {
            Log.w(TAG, FAILED_TO_CLEAR_STICKERS, e);
            Toast.makeText(context, FAILED_TO_CLEAR_STICKERS, Toast.LENGTH_SHORT).show();
        }
    });
}
 
开发者ID:firebase,项目名称:quickstart-android,代码行数:18,代码来源:AppIndexingUtil.java


示例2: indexNote

import com.google.firebase.appindexing.FirebaseAppIndex; //导入依赖的package包/类
private void indexNote() {
    Note note = mRecipe.getNote();
    Indexable noteToIndex = Indexables.noteDigitalDocumentBuilder()
            .setName(mRecipe.getTitle() + " Note")
            .setText(note.getText())
            .setUrl(mRecipe.getNoteUrl())
            .build();

    Task<Void> task = FirebaseAppIndex.getInstance().update(noteToIndex);
    // [START_EXCLUDE]
    task.addOnSuccessListener(new OnSuccessListener<Void>() {
        @Override
        public void onSuccess(Void aVoid) {
            Log.d(TAG, "App Indexing API: Successfully added note to index");
        }
    });

    task.addOnFailureListener(new OnFailureListener() {
        @Override
        public void onFailure(@NonNull Exception exception) {
            Log.e(TAG, "App Indexing API: Failed to add note to index. " + exception
                    .getMessage());
        }
    });
    // [END_EXCLUDE]
}
 
开发者ID:googlecodelabs,项目名称:app-indexing,代码行数:27,代码来源:RecipeActivity.java


示例3: indexRecipe

import com.google.firebase.appindexing.FirebaseAppIndex; //导入依赖的package包/类
private void indexRecipe() {
    Indexable recipeToIndex = new Indexable.Builder()
            .setName(mRecipe.getTitle())
            .setUrl(mRecipe.getRecipeUrl())
            .setImage(mRecipe.getPhoto())
            .setDescription(mRecipe.getDescription())
            .build();

    Task<Void> task = FirebaseAppIndex.getInstance().update(recipeToIndex);
    task.addOnSuccessListener(new OnSuccessListener<Void>() {
        @Override
        public void onSuccess(Void aVoid) {
            Log.d(TAG, "App Indexing API: Successfully added " + mRecipe.getTitle() + " to " +
                    "index");
        }
    });

    task.addOnFailureListener(new OnFailureListener() {
        @Override
        public void onFailure(@NonNull Exception exception) {
            Log.e(TAG, "App Indexing API: Failed to add " + mRecipe.getTitle() + " to index. " +
                    "" + exception.getMessage());
        }
    });
}
 
开发者ID:googlecodelabs,项目名称:app-indexing,代码行数:26,代码来源:RecipeActivity.java


示例4: onHandleIntent

import com.google.firebase.appindexing.FirebaseAppIndex; //导入依赖的package包/类
@Override
protected void onHandleIntent(Intent intent) {
    ArrayList<Indexable> indexableNotes = new ArrayList<>();

    for (Recipe recipe : getAllRecipes()) {
        Note note = recipe.getNote();
        if (note != null) {
            Indexable noteToIndex = Indexables.noteDigitalDocumentBuilder()
                    .setName(recipe.getTitle() + " Note")
                    .setText(note.getText())
                    .setUrl(recipe.getNoteUrl())
                    .build();

            indexableNotes.add(noteToIndex);
        }
    }

    if (indexableNotes.size() > 0) {
        Indexable[] notesArr = new Indexable[indexableNotes.size()];
        notesArr = indexableNotes.toArray(notesArr);

        // batch insert indexable notes into index
        FirebaseAppIndex.getInstance().update(notesArr);
    }
}
 
开发者ID:googlecodelabs,项目名称:app-indexing,代码行数:26,代码来源:AppIndexingService.java


示例5: reportIndexToGoogle

import com.google.firebase.appindexing.FirebaseAppIndex; //导入依赖的package包/类
private void reportIndexToGoogle() {
    if (course != null && !wasIndexed && course.getSlug() != null) {
        wasIndexed = true;
        FirebaseAppIndex.getInstance().update(getIndexable());
        FirebaseUserActions.getInstance().start(getAction());
        getAnalytic().reportEventWithIdName(Analytic.AppIndexing.COURSE_DETAIL, course.getCourseId() + "", course.getTitle());
    }
}
 
开发者ID:StepicOrg,项目名称:stepik-android,代码行数:9,代码来源:CourseDetailFragment.java


示例6: reportIndexToGoogle

import com.google.firebase.appindexing.FirebaseAppIndex; //导入依赖的package包/类
private void reportIndexToGoogle() {
    if (course != null && !wasIndexed && course.getSlug() != null) {
        wasIndexed = true;
        FirebaseAppIndex.getInstance().update(getIndexable());
        FirebaseUserActions.getInstance().start(getAction());
        getAnalytic().reportEventWithIdName(Analytic.AppIndexing.COURSE_SYLLABUS, course.getCourseId() + "", course.getTitle());
    }
}
 
开发者ID:StepicOrg,项目名称:stepik-android,代码行数:9,代码来源:SectionsFragment.java


示例7: accept

import com.google.firebase.appindexing.FirebaseAppIndex; //导入依赖的package包/类
@Override
public void accept(@NonNull Message message) throws Exception {
  FirebaseAppIndex.getInstance().update(getIndexable(message));
  FirebaseUserActions.getInstance().end(getAction(message));
}
 
开发者ID:ashdavies,项目名称:eternity,代码行数:6,代码来源:MessageIndexer.java


示例8: onHandleIntent

import com.google.firebase.appindexing.FirebaseAppIndex; //导入依赖的package包/类
@Override
protected void onHandleIntent(Intent intent) {
    AppIndexingUtil.setStickers(getApplicationContext(), FirebaseAppIndex.getInstance());
}
 
开发者ID:firebase,项目名称:quickstart-android,代码行数:5,代码来源:AppIndexingService.java


示例9: indexStep

import com.google.firebase.appindexing.FirebaseAppIndex; //导入依赖的package包/类
private void indexStep(@NotNull Step step) {
    FirebaseAppIndex.getInstance().update(getIndexable(step));
    FirebaseUserActions.getInstance().start(getAction(step));
}
 
开发者ID:StepicOrg,项目名称:stepik-android,代码行数:5,代码来源:LessonFragment.java



注:本文中的com.google.firebase.appindexing.FirebaseAppIndex类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WeldJoint类代码示例发布时间:2022-05-22
下一篇:
Java HasMouseUpHandlers类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap