1.Manifast.xml文件中添加权限:

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

2.发送广播:

Intent addIntent=new Intent("com.android.launcher.action.INSTALL_SHORTCUT");        Parcelable icon=Intent.ShortcutIconResource.fromContext(this, R.drawable.ic_launcher); //获取快捷键的图标        Intent myIntent=new Intent(this, MainActivity.class);        addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "快捷方式名字");//快捷方式的标题        addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);//快捷方式的图标        addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, myIntent);//快捷方式的动作        sendBroadcast(addIntent);

更多相关文章

  1. Android(安卓)AD Manifest
  2. android点滴4
  3. 为Android软件创建快捷方式
  4. JS判断客户端类型(ipad,iphone,android)
  5. android获取文件目录
  6. Flutter实现android应用内版本更新功能
  7. Android获取本地图片之ACTION_GET_CONTENT与ACTION_PICK区别
  8. Android获取本机信息(随时更新)
  9. Android中获取屏幕的宽和高

随机推荐

  1. Android(安卓)驱动之旅 (Based on Galaxy
  2. 我是如何自学Android,资料分享(2015 版)
  3. Android(安卓)通过百度地图SDK 实现地图
  4. android ANR产生原因和解决办法
  5. SystemServer分析
  6. Android(安卓)系统框架介绍
  7. LeakCanary使用详细教程(附Demo)
  8. Android(安卓)创建定时任务
  9. Android中通过view.getContext获取Activi
  10. Android中JNI的使用方法