All-in-one codes

1. BigContentTitle (CharSequence)

Position of BigContentTitle

This BigContentTitle is only shown when the BigText notification is expanded. It is a replacement of the contentTitle which is set at the Notification builder (See the line 27 of the above sample code).

2. SummaryText (CharSequence)

Position of SummaryText

This is a supplementary text shown in between the app name and the time (when) property of notification.

Bear in mind that this summaryText is overridden by the subText of the NotificationBuilder . See the line 31 of the sample code shown above.

3. Line

Position of Line

Each line is represented by an individual TextView and is fixed to be in single line. Text is truncated at the end when it is too long.

There is a discrepancy on the limit of line stated at different official documentation pages. This official page states the limit is 6 while the another one states it is 5. So which one is correct?

Notification creation official documentation

I was confused with these documentations when I was studying about InboxStyle . Therefore, I decided to read through the InboxStyle open source code and finally find out a mysterious answer — Max number of line is actually 7!

Starting from the line 7879, it is the makeBigContentView function which is called to construct a view for the notification expanded state. In line 7884, the rowIds array is constructed by a set of 7 view ids and each id points to a TextView . At this moment, I am curious whether the maximum number of line is 7. After running the following codes, the 8th line is not shown and it verifies my suspicion.

So, can we say that the maximum number of line is “always” 7? No! Let’s take a look at the line 7898. The maximum number of line has to be reduced by 1 in order to release spaces for displaying a row of action button.

See below codes:

Screenshot with action button

Is there any even more undocumented situation the maximum number of line is not either 6 or 7? Yes and it is the number of remote input history added. See the codes from line 7901 to 7922.:

Source code showing the value of NUMBER_OR_HISTORY_ALLOWED_UNTIL_REDUCTION

Source code showing the value of MAX_REMOTE_INPUT_HISTOYR_LINES

These codes mean the maximum number of row would be reduced when there are more than 2 remote input histories. Moreover, there can only be at most 3 remote input histories to be shown at the same time.

Below are the codes for verification and screenshots of results:

Screenshot when there is only 1 remote input history

Screenshot when there is only 2 remote input histories

Screenshot when there is only 3 remote input histories

To conclude, the max number of line to be shown depends on both the existence of action button and the number of remote histories shown. This documentation issue has been submitted to Google Issue Tracker since I wrote this article in 2020. See below table for a short summary: