Android 检查应用程序启动器是否默认具有应用程序抽屉或主应用程序的菜单键/向上滑动
我试图在家里创建应用程序快捷方式。我在大多数设备上都做得很好。Android 检查应用程序启动器是否默认具有应用程序抽屉或主应用程序的菜单键/向上滑动,android,android-9.0-pie,android-8.1-oreo,app-launcher,android-appshortcut,Android,Android 9.0 Pie,Android 8.1 Oreo,App Launcher,Android Appshortcut,我试图在家里创建应用程序快捷方式。我在大多数设备上都做得很好。 用这个 private void setShortcutIcon() { if (ShortcutManagerCompat.isRequestPinShortcutSupported(this)) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { final ShortcutManager s
用这个
private void setShortcutIcon() {
if (ShortcutManagerCompat.isRequestPinShortcutSupported(this)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
final ShortcutManager shortcutManager = getSystemService(ShortcutManager.class);
final ShortcutInfo pinShortcutInfo = new ShortcutInfo.Builder(this, "334")
.setIcon(Icon.createWithResource(this, R.mipmap.ic_launcher))
.setShortLabel(getString(R.string.app_name))
.setIntent(new Intent(this, SplashActivity.class).setAction(Intent.ACTION_VIEW).putExtra("duplicate", false))
.build();
shortcutManager.requestPinShortcut(pinShortcutInfo, null);
} else {
final Intent shortcutIntent = new Intent(getApplicationContext(), SplashActivity.class);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
final Intent addIntent = new Intent();
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name));
addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(getApplicationContext(), R.mipmap.ic_launcher));
addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
addIntent.putExtra("duplicate", false);
getApplicationContext().sendBroadcast(addIntent);
}
}
}
默认情况下,除了在home上安装了应用程序的设备之外,在本例中,home上已经安装了应用程序图标,并且创建了一个重复图标作为快捷方式,这不是预期的行为
所以我开始寻找这种区别
我想知道当前的应用程序启动程序是否有专用的菜单按钮或应用程序列表的刷起行为(牛轧糖、奥利奥和馅饼),或者默认情况下应用程序显示在主页上
例如,大多数android手机都有带菜单按钮的启动器,用于查看应用程序列表
和其他ROM一样,MIUI也有默认的启动程序,应用程序默认放在家里
感谢您的帮助/建议。一种方法是删除任何现有的快捷方式(即使是第一次),然后添加新的快捷方式。这不起作用,因为这里的问题不是重复的快捷方式,而是应用程序本身和“重复”的快捷方式在主屏幕中,如果设备将其所有应用程序放入homescreenRight,@jackz314。。。