如何为文本指定一些自定义 Logo 和样式信息。或者一些自定义操作按钮,就像 Android 中的音乐播放器通知一样。
PS:我已经成功地使用我的应用程序配置了 GCM,并且能够接收来自 GCM 服务器的通知。应用程序是使用 cordova
开发的最佳答案
您应该阅读更多有关 Android 中的丰富通知的信息。来自官方文档:
To have a notification appear in an expanded view, first create a NotificationCompat.Builder object with the normal view options you want. Next, call Builder.setStyle() with an expanded layout object as its argument.
请看下面的例子:
NotificationCompat.BigTextStyle textDiv = new NotificationCompat.BigTextStyle();
textDiv.bigText(bodyMessage);
notification = new NotificationCompat.Builder(context)
.setTicker(bodyMessage)
.setContentTitle(titleMessage)
.setSmallIcon(notificationIcon)
.setStyle(textDiv)
.setPriority(1)//priority high
.setVibrate(new long[0])
.build();
关于android - android推送通知的自定义设计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34381740/