本文整理汇总了Java中android.content.pm.ShortcutManager.reportShortcutUsed方法的典型用法代码示例。如果您正苦于以下问题:Java ShortcutManager.reportShortcutUsed方法的具体用法?Java ShortcutManager.reportShortcutUsed怎么用?Java ShortcutManager.reportShortcutUsed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.pm.ShortcutManager
的用法示例。
在下文中一共展示了ShortcutManager.reportShortcutUsed方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleIntent
import android.content.pm.ShortcutManager; //导入方法依赖的package包/类
/**
* Handle the incoming intent of shortcut
* Returns true if shortcut was handled, false otherwise
*/
private boolean handleIntent() {
String shortcutID;
if (getIntent().getAction() != null && getIntent().getAction().equals(SHORTCUT_INTENT_STRING)) {
shortcutID = SHORTCUT_ID;
doToggle();
} else return false;
/*
* On Android 7.0 or below, bail out from now
* This is because app shortcuts are not supported by default in those android versions
* It however is supported in 3rd party launchers like nova launcher.
* As android API guidelines suggest to reportShortcutUsed(), but that can be done only on API 25
*/
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) return true;
ShortcutManager shortcutManager = this.getSystemService(ShortcutManager.class);
shortcutManager.reportShortcutUsed(shortcutID);
return true;
}
示例2: report
import android.content.pm.ShortcutManager; //导入方法依赖的package包/类
@TargetApi(25)
public void report(Contact contact) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
ShortcutManager shortcutManager = xmppConnectionService.getSystemService(ShortcutManager.class);
shortcutManager.reportShortcutUsed(getShortcutId(contact));
}
}
示例3: reportShortcutUsageGuarded
import android.content.pm.ShortcutManager; //导入方法依赖的package包/类
/**
* Call to report a shortcut used.
* You may call this using any api level.
*
* @param context to access system services
* @param channelId id of the channel that has been selected
*/
public static void reportShortcutUsageGuarded(Context context, String channelId) {
if (areShortcutsSupported()) {
ShortcutManager shortcutManager = context.getSystemService(ShortcutManager.class);
if (shortcutManager != null) {
shortcutManager.reportShortcutUsed(channelId);
}
}
}
示例4: reportNewTabShortcutUsed
import android.content.pm.ShortcutManager; //导入方法依赖的package包/类
/**
* Reports that a new tab launcher shortcut was selected or an action equivalent to a shortcut
* was performed.
* @param isIncognito Whether the shortcut or action created a new incognito tab.
*/
@TargetApi(Build.VERSION_CODES.N_MR1)
private void reportNewTabShortcutUsed(boolean isIncognito) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) return;
ShortcutManager shortcutManager = getSystemService(ShortcutManager.class);
shortcutManager.reportShortcutUsed(
isIncognito ? "new-incognito-tab-shortcut" : "new-tab-shortcut");
}
示例5: recordShortcutUsage
import android.content.pm.ShortcutManager; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.N_MR1)
private void recordShortcutUsage(String shortcut) {
ShortcutManager shortcutManager = getSystemService(ShortcutManager.class);
shortcutManager.reportShortcutUsed(shortcut);
}
示例6: reportShortcutUsed
import android.content.pm.ShortcutManager; //导入方法依赖的package包/类
private void reportShortcutUsed(String shortcutId) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N_MR1) {
ShortcutManager shortcutManager = (ShortcutManager) getSystemService(SHORTCUT_SERVICE);
shortcutManager.reportShortcutUsed(shortcutId);
}
}
示例7: reportPostUsed
import android.content.pm.ShortcutManager; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.N_MR1)
public static void reportPostUsed(@NonNull Context context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) return;
ShortcutManager shortcutManager = context.getSystemService(ShortcutManager.class);
shortcutManager.reportShortcutUsed(POST_SHORTCUT_ID);
}
示例8: reportSearchUsed
import android.content.pm.ShortcutManager; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.N_MR1)
public static void reportSearchUsed(@NonNull Context context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) return;
ShortcutManager shortcutManager = context.getSystemService(ShortcutManager.class);
shortcutManager.reportShortcutUsed(SEARCH_SHORTCUT_ID);
}