NotificationListenerService não está lendo o texto das notificações empilhadas

Espero que isso não viole nenhuma regra, pois tentei seguir o guia Como fazer.

Estou tentando ler as notificações recebidas usando o NotificationListenerService e funciona para mim, mas apenas parcialmente.

A primeira notificação desse tipo, digamos - whatsapp, posso obter o código, o texto e o título, mas depoisse as notificações se acumularem, não será mais possível ler o texto das mensagens.

Como obtenho o texto das notificações empilhadas?

Aqui está o código que eu implemento atualmente:

public class NotificationService extends NotificationListenerService {

    private Context context;


    @Override
    public void onCreate() {
        super.onCreate();
        context = getApplicationContext();

    }

    @Override
    public void onNotificationPosted(StatusBarNotification sbn) {
        String pack = sbn.getPackageName();
        String ticker = sbn.getNotification().tickerText.toString();
        Bundle extras = sbn.getNotification().extras;
        String title = "";
        String text = "";


        if (extras.containsKey("android.title")) {
            title = extras.getString("android.title");
        }

        if (extras.containsKey("android.text")) {
            if (extras.getCharSequence("android.text") != null) {
                text = extras.getCharSequence("android.text").toString();
            }
        }
        if (pack != null) {
            Log.i("Package", pack);
        }

        if (ticker != null) {
            Log.i("ticker", ticker);
        }

        if (title != null) {
            Log.i("Title", title);
        }

        if (text != null) {
            Log.i("Text", text);
        }


    }

    @Override
    public void onNotificationRemoved(StatusBarNotification sbn) {

    }


}

questionAnswers(2)

yourAnswerToTheQuestion