Android 8.0 icationicationchannel mining example,

Source: Internet
Author: User

Android 8.0 icationicationchannel mining example,
New Notification features on Android O: Notification channel function 1. introduction: The notification channel function enables developers to manage notifications of their applications as a group or channel. Users can set notifications through the notification channel, such as blocking all notifications, change the priority of a channel notification to see whether the dots on the launch are displayed. These methods are used to improve the user experience. 2. 1. Step 1: Upgrade the sdk version. The minsdkversion developed using android studio cannot be less than 26. Otherwise, the new features cannot be used. 2. Part 2: Create a project. It is best to put icationicationchannel in util and encapsulate it into a separate class for management. From the analysis of android intent, notifications of each application must be managed, including the priority of notifications, which must be centrally managed through channels, you can create important_high/importan_default/importan_minor/importan_low channels. Method for creating a channel: // instantiate a channel object icationicationchannel androidChannel = new icationicationchannel (ANDROID_CHANNEL_ID, ANDROID_CHANNEL_NAME, icationicationmanager. IMPORTANCE_DEFAULT); ANDROID_CHANNEL_ID: the channel id ANDROID_CHANNEL_NAME: the channel name (this name is very important, and the channel name specified when the notification is sent later). The last parameter is: priority of notifications for this channel // create a channel icationicationmanager. createNotificationChannel (androidChannel); 3. create a new notification and send it out // use the new interface to create a builder object, specifying the channel builder of the notification = New Notification. builder (getApplicationContext (), ANDROID_CHANNEL_NAME/* channel name */) // sends a notification to icationicationmanager. notify (id, builder. build () In addition: micationicationmanager. createNotificationChannelGroup (new NotificationChannelGroup (groupId, groupName); this interface is also very interesting.
For apps with multiple users, such as some social applications with work accounts and private accounts, all the channels under different users can be defined as a group for management.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.