在我的应用程序中,我有一个使用WebView的活动。
当我按下主页按钮,然后点击图标我的应用程序 - 网页不重新加载 - 这是好的。 但在代码中我手动创建图标:
private void createIcon(int iconId){
final Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
ComponentName name = new ComponentName(getPackageName(), ".FullScreenBrowserActivity");
shortcutIntent.setComponent(name);
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, "Fulscreen Browser");
addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(this, iconId));
addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
this.sendBroadcast(addIntent);
}
当我点击此图标时 - 应用程序启动自己的新副本并开始加载网页。
如何在桌面设备上创建新图标(安装后)和点击图标 - WebView中的网页不重新加载?
谢谢!