Detect long press on the app's icon from the launcher

Viewed 535

I need to get a notification when the user long-presses my app's icon from the launcher screen.

After a lot of research - I encountered 'app shortcuts' and it seems the closest thing to the functionality I need, though I couldn't find any event or broadcast fired upon long pressing my app's icon.

I don't think this has been answered here before since I'm trying to find a solution for hours now. I looked into all the tutorials under AD: https://developer.android.com/guide/topics/ui/shortcuts.html

I also tried googling any possible combination might give me some leads, but couldn't find anything.

The functionality in possible (saw another app uses it), though running

dumpsys activity broadcasts

I couldn't find any related broadcast.

Is there's any standard broadcasts fired by the launcher maybe?

1 Answers

Is there's any standard broadcasts fired by the launcher maybe?

Well, there are hundreds, if not thousands, of launcher implementations, both pre-installed and user-installed. There is no requirement for any of them to send a broadcast in any situation, let alone specifically a long-press on a launcher icon. There is no requirement that there even be a launcher icon — the launcher does not have to use icons.

So, no, there is nothing that you can do for this that will offer this on each of the ~2.5 billion Android devices.

Note a device manufacturer's own launcher can do things with that manufacturer's own apps that it might not do with arbitrary third-party apps like yours or mine.

The functionality in possible

Then you should see the broadcast in Logcat.

Related