I was reading a tutorial on google official website for building Notification
While implementing the code I noticed that NotificationCompat is existed in both Support Libraries V4 and V7.
what is the difference between them though?
Does any of them help to push the notification to Lock Screen ?
public class NotificationCompat.Builder. Builder class for NotificationCompat objects. Allows easier control over all the flags, as well as help constructing the typical notification layouts. On platform versions that don't offer expanded notifications, methods that depend on expanded notifications have no effect.
To expand a notification, tap the Down arrow . Then, to act directly from a notification, tap an action, like Reply or Archive. Some apps show a dot when you get a notification. Touch and hold the app with the dot to see the oldest notification.
Note that v7 NotificationCompat was deprecated in API level 26, and that v4 was expanded a bit. If your compileSdk is 26+, you must use v4.
As you can see in the docs, v7 inherits from v4 and then adds some more functionality.
android.support.v7.app.NotificationCompat
An extension of NotificationCompat which supports NotificationCompat.MediaStyle. You should start using this variant if you need support for media styled notifications.
v7 can do everything v4 can. The only difference is that v7 also supports .MediaStyle
, while v4 does not.
Regarding lock screen, there are some constants that define how they work, e.g. if they are shown or not:
VISIBILITY_PRIVATE, VISIBILITY_PUBLIC and VISIBILITY_SECRET
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With