Java 在主页中创建应用程序快捷方式而不使用午餐应用程序

Java 在主页中创建应用程序快捷方式而不使用午餐应用程序,java,android,android-broadcastreceiver,Java,Android,Android Broadcastreceiver,我正在开发Android应用程序。我想创建应用程序快捷方式,但不需要午餐。我也尝试过代码,但在这方面,我们必须至少加载一个应用程序。但我想在应用程序安装到设备时创建应用程序快捷方式应用程序午餐不是必需的。 就像Flipkart一样,它可以在设备中安装后自动生成应用程序快捷方式,无需安装应用程序 我也尝试使用广播接收器来实现这一点,但没有成功 Manifeasts.xml <uses-permission android:name="com.android.launcher.permiss

我正在开发Android应用程序。我想创建应用程序快捷方式,但不需要午餐。我也尝试过代码,但在这方面,我们必须至少加载一个应用程序。但我想在应用程序安装到设备时创建应用程序快捷方式应用程序午餐不是必需的。 就像Flipkart一样,它可以在设备中安装后自动生成应用程序快捷方式,无需安装应用程序

我也尝试使用广播接收器来实现这一点,但没有成功

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>
}

在这段代码中,应用程序安装时未调用Broascast接收器。我不知道这段代码中缺少了什么

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);

}