gpt4 book ai didi

android - 无法解析 setLatestEventInfo 我使用的 sdk 版本是 23

转载 作者:行者123 更新时间:2023-11-29 00:06:55 36 4
gpt4 key购买 nike

Notification notification = new Notification(R.drawable.stat_sample,
getText(R.string.new_friend_request_exist),
System.currentTimeMillis());

Intent i = new Intent(this, UnApprovedFriendList.class);
i.putExtra(FriendInfo.FRIEND_LIST, tmp);

PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
i, 0);

notification.setLatestEventInfo(this, getText(R.string.new_friend_request_exist),
"You have new friend request(s)",
contentIntent);

上面的代码有什么问题?................................................ ..................................................... ..................................................... ..

最佳答案

ya 因为它是不推荐使用的方法。你可以使用

NotificationCompat.Builder builder = new NotificationCompat.Builder(
this);
myNotification = builder.setContentIntent(contentIntent)
.setSmallIcon(R.drawable.yourstring)
.setTicker(notificationText).setWhen(System.currentTimeMillis())
.setAutoCancel(true)
.setContentTitle(getText(R.string.title))
.setContentText(notificationText).build();

关于android - 无法解析 setLatestEventInfo 我使用的 sdk 版本是 23,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33184032/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com