Well I don't have answers to all your questions but I can help you with something. As you mentioned that you want only statusbar notifications and not others like toasts and all. So for that purpose, you can try the following code in your service.
public void onAccessibilityEvent(AccessibilityEvent event) {
final int eventType = event.getEventType();
if (eventType == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED) {
Parcelable parcelable = event.getParcelableData();
if(parcelable instanceof Notification){
// statusbar notification
List<CharSequence> messages = event.getText();
if (messages.size() > 0) {
// here you can do whatever you want with the notification.
//Log.d(tag, "Saved event");
}
}
}
}
Also set a timeout in your onServiceConnected like this:
info.notificationTimeout=100;
I hope it works for you.