crazyfool
crazyfool

Reputation: 1463

Get Intent from Notification via Accessbility Service - Android

I have created an accessibility service so I can get certain notifications and display them in my app. This works fine I use event.getPackageName() to determine if I want that event displayed or not (ie is it a gtalk msg etc).

However I also want to be able to get the intent of that notification so I can use it in my application so for example if it was a google talk message clicking on the notification normally will take me to the talk thread.

Is there anyway to get that intent from the notification? I have googled and looked on here but haven't found anything similar, I've also looked through the options I have on event, getParceable looks like it could be what I need if its possible but I'm not sure how to handle that.

Any help would be appreciated. Thanks.

Rob

Upvotes: 1

Views: 320

Answers (1)

Jug6ernaut
Jug6ernaut

Reputation: 8325

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

Note with this example the event must be a Notification event, if you get any other then you will get a ClassCastException.

Upvotes: 2

Related Questions