문제

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