【发布时间】:2014-06-05 12:40:06
【问题描述】:
我有下面的代码在 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
中实现同样的目标【问题讨论】:
-
该代码并非“在所有安卓设备中都能完美运行”。它仅适用于具有侦听该广播的应用程序的设备,该应用程序是用户当前的主屏幕实现。没有要求任何主屏幕实现支持该广播。
-
普通软件!!这只是为了样品。在我的项目中,我创建了图标,以便该图标可以在浏览器中打开直接链接。请删除downvote,或者如果您愿意,您可以通过编辑问题来帮助我。
-
我没有否决你的问题。请重新阅读我的评论。