I have working on Android Application.I want to Create application Shortcut with out lunching this.I have also try this code but in this we must need to load Application at least one.but i Want to create application Shortcut when application install in device Application Lunching in not Required. Just Like Flipkart.it's automatically generate application shortcut once install in device no need to lunch app.
I also try to do this using Broadcaster Receiver but i didn't get success.my Code is like following.
Manifeasts.xml
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<receiver android:name=".fragmentTesting.ApplicationBroadcastService">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
</intent-filter>
</receiver>
ApplicationBroadcastService.java
public class ApplicationBroadcastService extends BroadcastReceiver {
private static final String TAG = "onReceive";
@Override
public void onReceive(Context context, Intent intent) {
Log.e(TAG, "IN Receive Call");
Intent shortcutIntent = new Intent(context, RecycleViewTesting.class);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Intent addIntent = new Intent();
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "MyAppName");
addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(context, R.drawable.ic_menu_send));
addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
context.sendBroadcast(addIntent);
}
}
In this code Broascast Receiver not called when app install.I don't know what I missing in this...?