文章分类:移动开发
创建应用程序的快捷方式如下:

Action

Java代码
private static final String ACTION_INSTALL_SHORTCUT = "com.android.launcher.action.INSTALL_SHORTCUT";


Java代码
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

Xml代码
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>

更多相关文章

  1. Android(安卓)利用TransitionDrawable 实现两张图片渐变切换
  2. android 中调用系统的发短信功能
  3. android 代码中设置字体大小
  4. 关于Android(安卓)Studio3.0使用过程的一些报错
  5. [置顶] Android常用功能代码
  6. android 如何判断程序是否在前台运行
  7. Android(安卓)屏幕截图 代码
  8. Android(安卓)关于wifi管理的代码
  9. Android用代码安装APK,不用选择“打包安装程序”

随机推荐

  1. 如何以varchar字段为编号?
  2. MYSQL中的普通索引,主健,唯一,全文索引区
  3. mysql 题 大家帮我看看哪里错了
  4. 急啊,在线等!!mysql 如何实现增量备份
  5. MySQL数据库多表查询
  6. 在原最大分区基础上再增加分区方法
  7. 使用JDBC处理MySQL大数据
  8. MySql 优化之like语句
  9. mysql galera cluster 集群的分裂与仲裁
  10. linux CentOS 7.4下 mysql5.7.20 密码改