向后兼容性的作用
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
假设我没有得到常规的资源
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
它们都有一个notify
方法,适用于我测试过的设备(API级别至少为19)。
这里的Google示例甚至没有使用Compat
版本: