当前位置: 首页>>代码示例>>Java>>正文


Java FirebaseAppIndex类代码示例

本文整理汇总了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;未经允许,请勿转载。