Android中创建快捷方式:

在主Activity的OnCreate中,

SharedPreferences preferences = getSharedPreferences("count",MODE_WORLD_READABLE);
int count = preferences.getInt("count", 0);
if (count == 0) {

//当前Activity的名字,显示的图标,app的名字
createShortCut(MainActivity.this,R.drawable.ic_launcher,R.string.app_name);
}
Editor editor = preferences.edit();
editor.putInt("count", ++count);
editor.commit();


public void createShortCut(Activity act, int iconResId, int appnameResId) {
Intent shortcutintent = new Intent(
"com.android.launcher.action.INSTALL_SHORTCUT");
shortcutintent.putExtra("duplicate", false);
shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_NAME,
act.getString(appnameResId));
Parcelable icon = Intent.ShortcutIconResource.fromContext(
act.getApplicationContext(), iconResId);
shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,
new Intent(act.getApplicationContext(), act.getClass()));
act.sendBroadcast(shortcutintent);
}

AndroidManifest.xml中权限允许:

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

了解更多可以看:http://www.xmumu.com/post/2012-04-01/17357119

Phonegap创建快捷方式:

暂时没有方法,还在研究中,如果大家知道,麻烦能留言指导一下,非常感谢!




更多相关文章

  1. Android Market中产品图标设计原则
  2. Android图标设计标准和原则
  3. 【转】Android -- 探究Android的多分辨率支持以及各种类型图标尺
  4. Android 如何在Launcher桌面创建或者删除快捷图标
  5. android 5.0以上修改SearchView的搜索图标
  6. Android标题栏、状态栏图标文字颜色及背景动态变化
  7. Android Drawable图标生成工具
  8. android绘图画Chrome图标
  9. android 4.4 电池电量显示分析(低电量提醒与电池图标)Java 层

随机推荐

  1. Android绘图之绘制太极图
  2. Android(安卓)AsyncTask实现异步任务的执
  3. Android(安卓)Studio 常见 Build 问题 Er
  4. Android(安卓)HAL 开发 (1)
  5. Android(安卓)IOS WebRTC 音视频开发总结
  6. Androidstudio开发button按钮的操作以及
  7. Android(安卓)游戏开发基础
  8. Android(安卓)APIDemos 研读之一:android.
  9. Android(安卓)Handler 异步消息处理机制
  10. Activity Task 与 Intent Filter Flag