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


Java ShortcutManager.reportShortcutUsed方法代码示例

本文整理汇总了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;
}
 
开发者ID:corphish,项目名称:NightLight,代码行数:27,代码来源:StartActivity.java

示例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));
    }
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:8,代码来源:ShortcutService.java

示例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);
		}
	}
}
 
开发者ID:cemrich,项目名称:zapp,代码行数:16,代码来源:ShortcutHelper.java

示例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");
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:14,代码来源:ChromeTabbedActivity.java

示例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);
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:6,代码来源:ShortcutsActivity.java

示例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);
    }
}
 
开发者ID:rock3r,项目名称:launcher-icon,代码行数:7,代码来源:MainActivity.java

示例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);
}
 
开发者ID:yongjhih,项目名称:android-proguards,代码行数:7,代码来源:ShortcutHelper.java

示例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);
}
 
开发者ID:yongjhih,项目名称:android-proguards,代码行数:7,代码来源:ShortcutHelper.java


注:本文中的android.content.pm.ShortcutManager.reportShortcutUsed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。