The standard short click on a Notification fires the PendingIntent held in it.
Is it possible to catch other events?
The requirement is to catch a Long Press.
Although you can create custom Notification-Views with NotificationCompat and RemoteViews you have no means to manipulate underlying click-behavior. The only options you have got is to change some parameters for a handfull of ViewTypes:
So to answer your Question: No, with the most current Google API (api lvl 17 - 14.01.2013) you can not insert a onLongClickListener into any of the view-elements within a notification.
Why is this so?
RemoteView is only a boiled down, simpler derivate of a View. It is not even related to View (RemoteView extends Object) therefore does not provide all the options you would have in a real View (View.setOnLongClickListener()) .
What are RemoteViews?:
A RemoteView can be executed by another process with the same permissions as the original application(that is why they are called Remote Views). This way widgets and notifications run with the permissions of its defining application.
From ICS on, long press on a notification triggers the "App Info" option, so you can see which app is sending it (useful to identify spamming apps) Also, from JellyBean on, you have enriched notifications that allow you to do many things, including more than one action, probably you can solve your problem with that.
Shalafi
If you want more insight I recommend these articles:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With