0

我有以下代码,它们在 android 设备中完美运行,但在Nokia-x中却没有

这是示例代码:

Intent shortcutIntent = new Intent(getApplicationContext(), MainActivity.class);
                shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

                Intent addIntent = new Intent();
                addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
                addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Icon Test");
                addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(getApplicationContext(), R.drawable.ic_launcher));
                addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
                getApplicationContext().sendBroadcast(addIntent);

请帮助我在Nokia-x中实现同样的目标

4

2 回答 2

1

正如已经确定的诺基亚 X 应用程序启动器不收听该广播,启动器的想法也与其他 AOSP 设备有点不同,并且不会看到非常适合快捷图标的设计。

无论如何,Fastlane 会显示所有通知,因此,如果您想创建一个任务的快捷方式,那么对于诺基亚 X,您应该使用任务的通知。

于 2014-06-05T17:13:46.813 回答
0

实际上诺基亚 X 没有主屏幕,它有的是应用程序启动器(磁贴)。甚至称为 fastlane 的通知窗格。您的代码适用于启动器上的主屏幕,例如Nova Launcher. 即使我Nova Launcher在我的诺基亚 X 上使用。

于 2014-07-07T18:15:54.347 回答