I don\'t think this is possible, as I haven\'t found anything in the SDK documentation (yet).
But I could do with knowing if its possible to write an application whi
It's possible to catch Messages/Notifications with an Accessibility Service, have a look at that.
You can extend the class AccessibilityService and override the method onAccessibilityEvent()
to implement something like this:
public void onAccessibilityEvent(AccessibilityEvent event) {
if (event.getEventType() != AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED)
return; // event is not a notification
String sourcePackageName = (String) event.getPackageName();
Parcelable parcelable = event.getParcelableData();
if (parcelable instanceof Notification) {
// Statusbar Notification
}
else {
// something else, e.g. a Toast message
String log = "Message: " + event.getText().get(0)
+ " [Source: " + sourcePackageName + "]";
// write `log` to file...
}
}
Note: This didn't work for me on Android 2.2 as it doesn't seem to catch Toasts, but it worked on Android 4.0+.