if (msg instanceof DataMessageStanza) {
for (AppData appData : ((DataMessageStanza) msg).getAppdataList()) {
if (appData.getKey().equals("NOTIFICATION_PAYLOAD")) {
byte[] bs = Base64.decode(appData.getValue(), Base64.URL_SAFE | Base64.NO_PADDING | Base64.NO_WRAP);
Notification notification = Notification.parseFrom(bs);
// TODO not every notification is for download! filter
// by type!
notificationListener.notificationReceived(notification);
}