我正在使用PHP向Android和iOS设备推送通知。它完美地工作了。但是notifcaiton不能显示在多行上。
我使用了'\n‘字符,但它只在iOS上有效,在安卓上不起作用。
如何在Android设备上显示多行通知?
发布于 2016-12-07 07:32:32
是的,android通知在默认样式下不使用\n,你应该在普通模式下设置一个文本(单行),但如果你想在文本中使用\n,NotificationCompat.BigTextStyle()应该设置。
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(thisActivity)
.setSmallIcon(resourceDrowable)
.setContentTitle("My notification")
.setContentText("Hello World")
.setAutoCancel(true)
.setStyle(new NotificationCompat.BigTextStyle().bigText("My\nMessage"));https://stackoverflow.com/questions/41006759
复制相似问题