I have a messaging app integrated with Android Wear. Similar to Hangouts, when selecting a notification in an Android Wear Smartwatch, you can swipe to the second card which displays the conversation corresponding to the selected message. I implement it with a BigTextStyle
notification, but I need to know the max number of chars BigTextStyle
supports so I can trim properly the conversation when it's too large to completely fit. I couldn't find this info on documentation.
After some investigation, max chars are about 5000, at least in an Android Wear emulator. Therefore, I can do something like:
// scroll to the bottom of the notification card
NotificationCompat.WearableExtender extender = new NotificationCompat.WearableExtender().setStartScrollBottom(true);
// get conversation messages in a big single text
CharSequence text = getConversationText();
// trim text to its last 5000 chars
int start = Math.max(0, text.length() - 5000);
text = text.subSequence(start, text.length());
// set text into the big text style
NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle().bigText(text);
// build notification
Notification notification = new NotificationCompat.Builder(context).setStyle(style).extend(extender).build();
Does anyone know the exact number of characters that fit into a BigTextStyle
notification? Does it changes between different devices?