ブラウザを作成していて、サイトアイコン(apple-touch-icon)とタイトルがランチャーによって取り込まれて表示されるように、「ホーム画面にサイトを追加」ボタンを実装したい。Androidアイコンをホーム画面(ランチャー)に追加する
if (getIntent() != null){
Intent intent = getIntent();
//empty
String url1 = intent.getStringExtra("EXTRA_URL");
}
がどのように私は余分なparametr(URL)を渡す必要があり、:余分なデータがない
Intent shortcutIntent = new Intent();
shortcutIntent.setClassName(getPackageName(), "Browser");
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
shortcutIntent.addCategory(Intent.ACTION_PICK_ACTIVITY);
shortcutIntent.putExtra("EXTRA_URL", webView.getUrl());
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, webView.getTitle());
intent.putExtra(Intent.EXTRA_ORIGINATING_URI, webView.getUrl());
//TODO change to apple-touch icon
Bitmap btm = webView.getFaviconImage();
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, btm);
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
sendBroadcast(intent);
しかし、残念ながら、のonCreateで意図がある -
私はそれを行うコードを発見しました私はそれを読むことができるようにランチャーに?
を動作しない、まだ到着するデータがないテント –