Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
  • salvin francis
  • Frits Walraven
  • Piet Souris

How to remove application shortcut from home screen on uninstall automaticaly?

Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm developing an application that should add it's shortcut to home screen after installation and remove it after the application is being uninstalled. The application will be preinstalled on the end user device, but still should have an option for uninstall). The task looks very simple but I've faced lots of troubles implementing it.

What I have done:
  • Add shortcut to the home screen using on app first launch or on newt device reboot.
  • MANUALY remove shortcut using

  • What I can't (and almost giving up):
    Automaticaly remove the shortcut when the application is being uninstalled. There's not way to use Intent.ACTION_PACKAGE_REMOVED because the application being uninstalled does not receive this intent.

    I performed some tests and found out that the only shortcut type that is being removed with the application is the shortcut that is created from menu 'Add to home screen => Shortcuts => Applications => Application activity'. The shortcuts that are being created programatically or that are declared in AndroidManifest remain on home screen after the app is uninstalled.
    There's almost none docs and posts on forums about this topic and I'm confused a little bit why such a simple operation that doesn't contradict with the Android security policy could not be implemented in a straight way.

    Is there any way to ask OS to remove the corresponding shortcut on application uninstall?
    Can I catch the event that the application is being uninstalled before it is removed?
    Your mind is under my control .... your will is now mine .... read this tiny ad
    Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
      Bookmark Topic Watch Topic
    • New Topic