创建应用程序的快捷方式如下:

Action

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"/>

删除快捷方式试了很久没测试成功过,不知那位同学贡献一下代码?

更多相关文章

  1. 获取android系统信息或应用程序信息
  2. **android studio 编写淘宝界面## 标题**
  3. Android定时自动启动应用程序
  4. 构建更好的应用--Xamarin平台
  5. Android沉浸式状态栏
  6. android如何获取后台正在运行的service
  7. Android(安卓)读取正在运行非系统的程序
  8. Eclipse 开发 Android, Hello, DatePicker (学习7)
  9. Android(安卓)adb截屏命令

随机推荐

  1. Android实战技巧之十二:Android(安卓)Stud
  2. ARCore1.2使用入门(一) ------ 将ARCore案
  3. Android(安卓)横竖屏切换设置的 configCh
  4. android面试之线程、进程、Handler
  5. Android(安卓)异步任务使用分析
  6. 【源码分享下载】每日更新之高仿京东商城
  7. Android(安卓)Studio很卡,操作很不顺的点
  8. android 引入 iconv 库
  9. Android(安卓)Navigation Architecture C
  10. 4412 矩阵键盘