Action:
private static final String EXTRA_SHORTCUT_DUPLICATE = "duplicate";
private static final String ACTION_INSTALL_SHORTCUT = "com.android.launcher.action.INSTALL_SHORTCUT";
Intent shortcutIntent = new Intent(ACTION_INSTALL_SHORTCUT);
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME,
getString(R.string.app_name));
shortcutIntent.putExtra(EXTRA_SHORTCUT_DUPLICATE, false);
Intent intent = new Intent();
intent.setComponent(new ComponentName(this.getPackageName(),
".Splash"));
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent);
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(this,
R.drawable.icon));
sendBroadcast(shortcutIntent);
Uses permission:
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
分享到:
相关推荐
仿照微信或是淘宝网,发送快捷方式到桌面,主要代码如下: // 安装的Intent Intent shortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT"); // 快捷名称 shortcut.putExtra(Intent.EXTRA...
在android手机中创建应用APP的快捷方式,在本实例中,创建快捷方式是从用户单击了按钮开始,当然这只是演示,在实际使用中,可能由APP安装程序直接创建快捷方式,实现方法与以下代码相似: //按下了按钮时 ...
Shortcut创建快捷方式及使用说明,介绍如何使用Shortcut.exe快速方便地创建快捷方式
vs2008 c++代码调试通过,可以通过代码创建快捷方式,可以选择并添加图标,封装成了一个函数,很好用。
ShortCut.exe_命令行创建快捷方式。 例: shortcut /? shortcut D:\Tencent\QQ\Bin\QQ.exe /h ctrl+shift+alt+f4 /ld c.lnk shortcut D:\Tencent\QQ\Bin\QQ.exe /d hello /ld c.lnk shortcut D:\Tencent\QQ\Bin\...
在命令行创建快捷方式的工具SHORTCUT.EXE
在Android中创建与删除快捷方式(shortcut)的demo
AppFile 你希望创建快捷方式的文件名。 /a 可选参数—用于执行文件名的额外辅助参数。 /h 可选参数—指定某快捷方式热键 [ctrl+alt+shift+f1]。 /s 可选参数—用于设置程序窗口的显示方式 [默认:常规1,最小...
Android 创建快捷方式图标,这个挺简单,有兴趣的Android初学者可参考研究. Intent.ShortcutIconResource.fromContext(this, R.drawable.png1);//图标 //创建点击快捷方式后操作Intent,该处当点击创建的快捷方式后...
Android创建桌面的快捷方式 概述 :创建桌面快捷方式相当与创建一个程序的入口,就像我们程序在安装完毕后会自动创建一个图标到桌面。其实创建桌面快捷方式跟创建一个程序入口差不多,但是像QQ会话一样创建一个QQ...
shortcut快捷方式的添加删除与查询是否存在
命令行创建快捷方式的工具Shortcut及语法和范例 包含程序\语法说明\范例
android中在桌面上创建快捷方式源码,删除快捷方式在某些机器上会不成功,因此最好只添加不删除
自己写的shortcut.exe命令行创建快捷方式源代码,很早以前写的小工具,一直没有维护,特附上源码。
Shortbread Android库,为使用@Shortcut注释的活动和方法生成应用程序快捷方式。 无需触摸清单,创建XML文件或使用快捷方式管理器。 只需注释您想要的代码即可,即sh Shortbread Android库可为使用@Shortcut注释的...
一个android库可以轻松创建新的android 7.1快捷方式。
The ShortcutBadger makes your Android App show the count of unread messages as a badge on your App shortcut! Supported launchers: Sony Samsung LG HTC ...
nativescript-app-short-demo 使用NativeScript演示Android 7.1应用程序快捷方式
终于实现用命令创建文件的快捷方式了.好长时间才找到这个好东西.下面是说明.或者下载后输入 shortcut -h 就能看到了. shortcut: [-? -h -f -c -r -s] [[-t] 目标 [[-n] 名称]] [-d 工作目录] [-a Arguments] [-i ...