本文整理匯總了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);
}