我正在开发一个将从我的网站分发的应用程序。因此,当安装此应用程序时,应在主屏幕中创建快捷方式,并且我使用了以下代码,并且在安装时创建了快捷方式图标,但带有一条敬酒消息。我想隐瞒这则吐司消息。我添加了用于创建快捷方式主页图标的功能。
private void addShortcut() {
//Adding shortcut for MainActivity
//on Home screen
Intent shortcutIntent = new Intent(getApplicationContext(),
MainActivity.class);
shortcutIntent.setAction(Intent.ACTION_MAIN);
Intent addIntent = new Intent();
addIntent
.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "HelloWorldShortcut");
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);
}
我知道这个问题已经问了,但没有答案。所以我用代码和图像以不同的方式提出了问题。
从android烘烤的研究中,我发现无法删除短切创作中的烘烤物。如果您正在浏览Google Store,则可以在主屏幕上创建快捷方式图标的选项。那么,吐司就不会来了。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句