Search code examples
androidhomescreenandroid-shortcutandroid-shortcutmanager

Home Screen Listener?


I want to detect if the user has manually added or remove a shortcut of my application in the home screen. I tried to use broadcast receivers for the actions below: com.android.launcher.permission.UNINSTALL_SHORTCUT com.android.launcher.permission.INSTALL_SHORTCUT

But they are not triggered when I manually adding or removing a shortcut of my application to and from my homescreen.

I wonder if there are listeners for this? I searched on Android Developer site and didn't find any information about this.


Solution

  • So for anyone who encounter this issue. I tried to solve this with different approaches as described below:

    1. To use broadcast receivers for the actions com.android.launcher.permission.UNINSTALL_SHORTCUT com.android.launcher.permission.INSTALL_SHORTCUT but as I said before, they were not triggered and I couldn't listened for the home screen in order to detect if the user has manually added or removed a shortcut. Moreover, @CommonsWare comment is correct :)

    2. I tried to check inside my application, using ShortcutManager or PackageManager and see if the application shortcut already exists on the Home Screen, but as you can guess, there was no way to find it...

    So... bottom line -> it is not possible