[Aerogear-users] cordova push android BigText

Kelvin Lunsford kelvin at qantel.com
Thu Aug 13 23:44:18 EDT 2015

On ios the message text wraps when a long message is displayed but on android only one line is displayed by default, truncating if too long.  

In a previous thread Erik pointed out that there is a lot of freedom for how messages are displayed in the Android notifications panel by making changes to NotificationMessageHandler.java.  

I coded up a change so I could test BigTextStyle in android.  Using BigTextStyle on android lets the text wrap to multiple lines.

With the change I can use a UPS request like:
       "alert":"a long message"", 
       "gglbigtxt":"a long message", 
       "gglsummry":"unread count", 
to display wrapping messages in both android and ios.  Adding a summary line for the count value helps mitigate the missing badges on android.

I added the "gglinfo" key to display any value in the info area. The "msgcnt" key displays in the info area but will not display a number less than 1.

In NotificationMessageHandler.java before the line:

    manager.notify(appName, NOTIFICATION_ID, builder.build());


    String tmp;
    if ((tmp = extras.getString("gglbigtxt")) != null) {
      NotificationCompat.BigTextStyle bigStyle = new NotificationCompat.BigTextStyle().bigText(tmp);
      if ((tmp = extras.getString("gglsummry")) != null)
      if ((tmp = extras.getString("gglbigttl")) != null)
    if ((tmp = extras.getString("gglinfo")) != null)

I'm not recommending this be added to the plugin project as is, but it might be worth looking at.

- Kelvin

More information about the Aerogear-users mailing list