@TargetApi(Build.VERSION_CODES.N_MR1)
private void createShortcut() {
ShortcutManager shortcutManager = getSystemService(ShortcutManager.class);
Intent intent = new Intent(this, SplashActivity.class);
intent.setAction(ACTION_QUICK_START_OR_QUICK_STOP);
intent.putExtra(EXTRA_COME_FROM_SHORTCUT, true);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
ShortcutInfo shortcut = new ShortcutInfo.Builder(this, "shortcut_quick_switch")
.setShortLabel(getString(R.string.shortcut_quick_switch))
.setIcon(Icon.createWithResource(this, R.mipmap.ic_launcher))
.setIntent(intent)
.build();
if (shortcutManager != null) {
shortcutManager.setDynamicShortcuts(Collections.singletonList(shortcut));
}
}
SplashActivity.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:CurrentActivity
作者:
评论列表
文章目录