setLatestEventInfo定义
public void setLatestEventInfo(Context context,
CharSequence contentTitle, CharSequence contentText, PendingIntent contentIntent) {Notification.Builder builder = new Notification.Builder(context);
// First, ensure that key pieces of information that may have been set directly
// are preserved
builder.setWhen(this.when);
builder.setSmallIcon(this.icon);
builder.setPriority(this.priority);
builder.setTicker(this.tickerText);
builder.setNumber(this.number);
builder.setColor(this.color);
builder.mFlags = this.flags;
builder.setSound(this.sound, this.audioStreamType);
builder.setDefaults(this.defaults);
builder.setVibrate(this.vibrate);
// now apply the latestEventInfo fields
if (contentTitle != null) {
&

本文介绍了在Android中,如何在API23及以上版本中替换`setLatestEventInfo`方法来实现消息推送。内容包括使用`Notification.Builder`构建通知,设置点击事件、标题、内容以及图标,并确保通知在被点击后自动消失。
最低0.47元/天 解锁文章
887

被折叠的 条评论
为什么被折叠?



