Question

In my app I use an AccessibilityService to get all notifications. That works great but how can I get the intent which is started if the user click on the notification?

Was it helpful?

Solution

This raises the intent (Like if the user click the notification)

(This code goes inside the accessibility service)

Notification n = (Notification) event.getParcelableData();

    try {
        n.contentIntent.send();
    } catch (CanceledException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }

OTHER TIPS

I do not know this for sure but here are my 2-cents. When you create a notification you need to provide a PendingIntent. One of the differences between a PendingIntent and a regular Intent is that the PendingIntent is granted the same permissions the Context it will invoke (i .e. if it starts an Activity it will have the permissions that Activity possesses). If you were able to "intercept" that PendingIntent you would have those permissions. Therefore, I do not think it is possible.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top