I have code to make a shortcut of my application on the home screen when the user firsts opens the application. Is it possible to make it so that the application sets it so that when the user opens the application the shortcut is replaced with the widget?
This is the code that I am using to set the shortcut
Intent shortcutIntent = new Intent();
shortcutIntent.setClassName(".BatteryWidget", "SampleIntent");
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
shortcutIntent.putExtra("someParameter", "HelloWorld");
Intent addIntent = new Intent();
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, appName);
addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
this.sendBroadcast(addIntent);
-Thanks in advance.