[Aerogear-users] cordova push android BigText
Sebastien Blanc
scm.blanc at gmail.com
Fri Aug 14 01:54:53 EDT 2015
Hi !
Thanks a lot for this tip and indeed I think it's worth a discussion to see
if we could add some of these (android specific) keys to our sender API.
Sebi
On Fri, Aug 14, 2015 at 5:44 AM, Kelvin Lunsford <kelvin at qantel.com> wrote:
> 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:
> {
> "alias":["someuser"],
> "message":{
> "alert":"a long message"",
> "badge":33,
> "gglbigtxt":"a long message",
> "gglsummry":"unread count",
> "gglinfo":"33"
> }
> }
> 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());
>
> add:
>
> String tmp;
> if ((tmp = extras.getString("gglbigtxt")) != null) {
> NotificationCompat.BigTextStyle bigStyle = new
> NotificationCompat.BigTextStyle().bigText(tmp);
> if ((tmp = extras.getString("gglsummry")) != null)
> bigStyle.setSummaryText(tmp);
> if ((tmp = extras.getString("gglbigttl")) != null)
> bigStyle.setBigContentTitle(tmp);
> builder.setStyle(bigStyle);
> }
> if ((tmp = extras.getString("gglinfo")) != null)
> builder.setContentInfo(tmp);
>
>
> I'm not recommending this be added to the plugin project as is, but it
> might be worth looking at.
>
> - Kelvin
>
> _______________________________________________
> Aerogear-users mailing list
> Aerogear-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-users/attachments/20150814/b17ab33f/attachment.html
More information about the Aerogear-users
mailing list