package com.codewelt.singer;

import android.app.Notification;
import android.content.Intent;
import android.os.IBinder;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;

public class NotificationListenerLinusService extends NotificationListenerService {

    @Override
    public IBinder onBind(Intent intent) {
        return super.onBind(intent);
    }

    @Override
    public void onNotificationPosted(StatusBarNotification sbn) {
            if (sbn.getNotification().extras.getCharSequence(Notification.EXTRA_TITLE) == null ||
                sbn.getNotification().extras.getCharSequence(Notification.EXTRA_TEXT) == null) return;
            Intent intent = new  Intent("com.codewelt.singer");
            intent.putExtra("Notification Data", sbn.getPackageName() +
                    "###!!!###" + sbn.getNotification().extras.getCharSequence(Notification.EXTRA_TITLE).toString() +
                    "###!!!###" + sbn.getNotification().extras.getCharSequence(Notification.EXTRA_TEXT).toString());
            sendBroadcast(intent);
    }
}
