手机升级到安卓O后,突然发现创建快捷方式的功能失效了,查询一番后发现:安卓O要使用ShortcutManager来创建快捷方式。
安卓N及以下版本:
Intent addShortcutIntent = new Intent(com.android.launcher.action.INSTALL_SHORTCUT);//com.android.launcher.action.INSTALL_SHORTCUT
// 不允许重复创建
addShortcutIntent.putExtra(duplicate, false);// 经测试不是根据快捷方式的名字判断重复的
// 应该是根