This question already has an answer here:
- Why is NotificationCompat needed? 3 answers
Pretty much all the bits of sample code I see for Android notififactions appear to use NotificationCompat. I have written up my own code using Notification.Builder. It is not clear to me what benefits, if any, there might be in using NotificationCompat.Builder. I hope that someone here might be able to explain the differences.
You can use things like NotificationCompat.Builder#setLargeIcon(Bitmap) to allow you to take full advantage of Android 3.0+ with things like the large icon, while maintaining compatibility on versions of Android prior to 3.0 that do not support such things.
depends on what you are trying to do and what OS version's your app is compatible with but in most cases you would want to use NotificationCompat
because that provides backwards compatibility where as if you wanted to provide that with the regular Notification.Builder
you would have to check what OS version the device has yourself to use API calls that are not in older versions
来源:https://stackoverflow.com/questions/39749482/android-notification-builder-vs-notificationcompat-builder