當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。