The system may display this notification only in specific scenarios, such as when the user drops down the status bar PRIORITY_LOW indicates low importance. There are five constant values in total, which can be selected: PRIORITY_DEFAULT indicates the importance of default, which is the same as not setting PRIORITY_MIN indicates the lowest importance. setPriority(): sets the importance of this notification.
First parameter in intent android studio how to#
setStyle(new NotificationCompat.BigTextStyle().bigText("Learn how to build notifications,send and sync data, and use voice actions.Get the official Android IDE and developer tools to build apps for Android.")) If you want to display a long piece of text: //Set the display information of the notification box (not omitted) Get the official Android IDE and developer tools to buildapps for Android.") setContentText("Learn how to build notifications,send and sync data, and use voice actions. Set the display information of the notification box This method receives a notificationcompat Stytle parameter But if the number of words is too long, the following information will be omitted with.
When the system status bar is pulled down, the time specified here will be displayed on the corresponding notification. The setWhen() method is used to specify the time when the notification is created, in milliseconds.
The setContentTitle() method is used to specify the title content of the notification, which can be seen by pulling down the system status bar.This,) deprecated, using notificationcompat Builder(MainActivity.this,“my_channel_01”) Note: notificationcompat Builder (mainactivity. Here we pass in Context NOTIFICATION_ Service is enough. The getSystemService() method receives a string parameter to determine which service to obtain from the system. First, a NotificationManager is needed to manage notifications, which can be obtained by calling the getsystem service () method of Context.