【发布时间】:2019-03-05 15:23:47
【问题描述】:
我可以这样创建通知:
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (notificationManager != null) {
notificationManager.notify(NOTIFICATION_ID, notification);
}
等等:
NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(MainActivity.this);
notificationManagerCompat.notify(NOTIFICATION_ID, notification);
那么,这些方式有什么区别呢?
【问题讨论】:
-
如果你查看
NotificationManagerCompat的源代码,它在后台使用NotificationManager。
标签: java android push-notification android-notifications