public class NotificationUtil {
public static List idNotification = new ArrayList();
public static int iid;
public static void showNotification(String uid, String title, String text) {
iid++;
NotificationManager notificationManager = (NotificationManager)
CommonAppContext.sInstance.getSystemService(NOTIFICATION_SERVICE);
Notification notification = null;
Intent intent = new Intent(RouteUtil.MAIN);
intent.putExtra("notifForm", true);
intent.putExtra("uid", uid);
PendingIntent resultPendingIntent = PendingIntent.getActivity(
CommonAppContext.sInstance, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel mChannel = new NotificationChannel(iid + "", iid + "", NotificationManager.IMPORTANCE_HIGH);
Log.i("log", mChannel.toString());
notificationManager.createNotificationCh
Android notification 适配不同版本
最新推荐文章于 2021-08-06 14:57:30 发布
本文介绍了如何在不同Android版本上适配`Notification`,使用`NotificationManager`创建并管理通知。在API 26及以上版本,需要创建`NotificationChannel`,而在较低版本中,可以使用`NotificationCompat.Builder`进行构建。

最低0.47元/天 解锁文章
1840

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



