SoFunction
Updated on 2025-04-06

Creating shortcuts and deleting shortcuts in Android

Creating shortcuts and deleting shortcuts in Android

Updated: June 9, 2015 11:21:26 Submission: junjie
This article mainly introduces the implementation method of creating shortcuts and deleting shortcuts in Android. This article directly gives the implementation code. Friends who need it can refer to it.
/**
	  *
	  * Create a shortcut
	  * @param map shortcut icon
	  * @param appName Shortcut Title
	  * @param appUrl The address where the shortcut is opened
	  * @param iconUrl Shortcut icon address
	  *
	  * */
	public static void createShortcut(Context activity ,Bitmap map ,String appName ,String appUrl ,String iconUrl){
		Intent shortcut = new Intent(
				".INSTALL_SHORTCUT");
		(Intent.EXTRA_SHORTCUT_NAME,appName);
		("duplicate", false);// Set whether to create repeatedly		Intent intent = new Intent();
		(Intent.ACTION_VIEW) ;
//		(Intent.CATEGORY_LAUNCHER);
		(Intent.FLAG_ACTIVITY_NEW_TASK) ;
		(Intent.FLAG_ACTIVITY_CLEAR_TASK) ;
		(activity, );// Set the first page		("keyword", appUrl);
		("appName", appName) ;
		("iconUrl", iconUrl) ;
		(Intent.EXTRA_SHORTCUT_INTENT, intent);
		(Intent.EXTRA_SHORTCUT_ICON, map);
		(shortcut);		
	}
	/**
	  *
	  * Delete shortcuts
	  * @param shortcutName app name
	  * @param className Absolute path such as: getPackageName() + ".WebViewActivity"
	  *
	  * */
	public static void removeShortcut(Context cxt, String shortcutName, String className) {
    Intent shortcutIntent = new Intent(Intent.ACTION_VIEW);
    (cxt, className);
    Intent intent = new Intent(".UNINSTALL_SHORTCUT");
    (Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    (Intent.EXTRA_SHORTCUT_NAME, shortcutName);
    (intent);
  }

  • Android
  • create
  • delete
  • Shortcuts

Related Articles

  • Android custom camera, preview area cropping

    This article mainly introduces Android custom cameras and preview area cropping in detail. The sample code in the article is introduced in detail and has certain reference value. Interested friends can refer to it.
    2022-05-05
  • Go language beauty quickly hits rpm package implementation detailed explanation

    This article mainly introduces the beauty of Go language, quickly editing RPM package implementation, friends in need can learn from it for reference, I hope it can be helpful, I wish you more progress and get a promotion as soon as possible to get a salary increase
    2023-02-02
  • Android to obtain the signature public key and the private key encryption method (recommended)

    Below, the editor will bring you an article about how to encrypt and decrypt the signature public key and public key private key on Android (recommended). The editor thinks it is quite good, so I will share it with you now and give you a reference. Let's take a look with the editor
    2016-12-12
  • Detailed explanation of Android AlertDialog (dialog) instance

    Android often encounters the need for pop-up boxes in development. The ones that are often used include Dialog and Window pop-up boxes. The most essential difference between them is that dialog is a non-blocking dialog box, and popupwindow is a blocking dialog box. This article mainly introduces relevant information about Android AlertDialog (dialog box). Friends who need it can refer to it.
    2021-11-11
  • Android Dialog usage example explanation

    The dialog box is a small window that pops up on the current page. It is used to display some important prompt information, prompting the user to enter, confirm information, or display a certain status. For example: display the progress bar dialog box and exit prompt. Next, through this article, introduce the knowledge of the Android dialog box. Interested friends can take a look.
    2016-09-09
  • Android implements SMS encryption function (send encrypted SMS, decrypt local SMS)

    This article mainly introduces the relevant information on Android's SMS encryption function, including sending encrypted text messages and decrypting local text messages. Interested friends can refer to it.
    2016-01-01
  • Android implementation demo example of calling system albums and taking photos

    This article mainly introduces the demo examples of Android calling system albums and taking photos. The examples analyze the skills of Android calling system albums and taking photos. It has certain reference value. Friends who need it can refer to it.
    2015-10-10
  • Android imitation Didi Chuxing Verification Code Input Box Function Example Code

    Recently, the project manager gave us a pop-up function similar to Didi Chuxing filling in verification code. I was so busy getting this project requirement. I will share with you the example code of the Android imitation Didi Chuxing verification code input box function through this article. Please refer to it if you need it.
    2017-12-12
  • Learn more about the Interceptors of OkHttp3

    This article mainly introduces an in-depth understanding of OkHttp3's Interceptors. The editor thinks it is quite good. I will share it with you now and give you a reference. Let's take a look with the editor
    2019-01-01
  • Android draw multiple black vertical lines

    This article mainly introduces in detail to you the drawing of android multiple black vertical lines, which has certain reference value. Interested friends can refer to it.
    2018-05-05

Latest Comments