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?

有帮助吗?

解决方案

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();
    }

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top