how to automatically add application launcher icon to home screen when app is installed (android) -
how to automatically add application launcher icon to home screen when app is installed (android) -
i created android app. , want when install app should automatically add together shortcut / launcher icon home screen.
when install app launcher icon should created automatically.
i tried this: it's not working.
<uses-permission android:name="com.android.launcher.permission.install_shortcut" />
you need send broadcast:
//where context (e.g. current activity) final intent shortcutintent = new intent(this, someactivity.class); final intent intent = new intent(); intent.putextra(intent.extra_shortcut_intent, shortcutintent); // sets custom shortcut's title intent.putextra(intent.extra_shortcut_name, getstring(r.string.app_name)); // set custom shortcut icon intent.putextra(intent.extra_shortcut_icon_resource, intent.shortcuticonresource.fromcontext(this, r.drawable.icon)); // add together shortcut intent.setaction("com.android.launcher.action.install_shortcut"); sendbroadcast(intent); more info here:add shortcut android application home screen on button click
android android-launcher
Comments
Post a Comment