Wednesday, April 25, 2012

Parsing a Notification

I'm currently working on a new version of Announcify (yes, again) and intercepting all notifications so I can read them out loud. Android's AccessibilityService does a good job handing over all notifications to you. Moreover, it provides methods to get most of the text displayed in a notification. But "most of the text" is not enough! I wanted more! After studying the source code of RemoteViews I eventually came to the conclusion that Java Reflections are the way to go. You can find the source code over at StackOverflow: http://stackoverflow.com/questions/9292032

I don't guarantee you that this works on any version of Android other than 4.0.3, but it's said to work on other versions too. Head over to the comments at StackOverflow to get more information about compatibility and possible improvements of this quick and dirty hack!

No comments:

Post a Comment