How to apply a big view style to a notification using Parse library

Gorio picture Gorio · Feb 27, 2014 · Viewed 31.4k times · Source

This library works perfectly, but i have a doubt.

When I send a message to users with more than two lines, users can't see all message in notification area.

But I know that ANDROID can do it

http://developer.android.com/guide/topics/ui/notifiers/notifications.html#ApplyStyle. How to do it for notification from parse.com ?

Look the images to explain my problem

Image1 http://gorio.eng.br/parse1.png

Image2 http://gorio.eng.br/parse2.png

Answer

adneal picture adneal · Feb 27, 2014

Here's an example using Notification.BigTextStyle.

    final String someLongText = "fkdljfdldkfj;ldaksjfkladj;flja;lkjdfljadslfjaddfdsfafjdfad" +
            "fdl;akjf;lkdf;lkaj;flkjda;lkfjadljflk;adsjfladjflk;dfjlkdjflakdfjdaffjdlfjdjjj" +
            "adjflkjadlkfjad;lkfjad;sljf;ladkjajlkfjad;lksfjl;akdjf;lkdsajf;lkdjfkadj;flkad" +
            "jf;lkadjfkldas;lkfja;dljf;lkdasjf;lkadjs;lfjas;ldkfj;lkadsjfl;kadljfl;kasdjf;l" +
            "jdlskfjklda;fjadslkfj;sdalkfj;ladjf;lajdl;fkajld;kfjlajfl;adjfl;kajdl;fjadl;kfj;";

    final Notification.Builder builder = new Notification.Builder(this);
    builder.setStyle(new Notification.BigTextStyle(builder)
            .bigText(someLongText)
            .setBigContentTitle("Big title")
            .setSummaryText("Big summary"))
            .setContentTitle("Title")
            .setContentText("Summary")
            .setSmallIcon(android.R.drawable.sym_def_app_icon);

    final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    nm.notify(0, builder.build());

Example