简答
限制为5120个字符(5KB),但您无需限制邮件.这是在构建器上为您完成的.
详细解答
在您的代码中,您使用的是内部使用NotificationCompat.Builder的NotificationCompat.BigTextStyle.
当你调用setBigContentTitle时会发生这种情况
/**
* Overrides ContentTitle in the big form of the template.
* This defaults to the value passed to setContentTitle().
*/
public BigTextStyle setBigContentTitle(CharSequence title) {
mBigContentTitle = Builder.limitCharSequenceLength(title);
return this;
}
protected static CharSequence limitCharSequenceLength(CharSequence cs) {
if (cs == null) return cs;
if (cs.length() > MAX_CHARSEQUENCE_LENGTH) {
cs = cs.subSequence(0,MAX_CHARSEQUENCE_LENGTH);
}
return cs;
}
如果我们检查常量声明,我们发现了这一点
/**
* Maximum length of CharSequences accepted by Builder and friends.
*
*
* Avoids spamming the system with overly large strings such as full e-mails.
*/
private static final int MAX_CHARSEQUENCE_LENGTH = 5 * 1024;