1<?xml version="1.0" encoding="UTF-8"?> 2<!-- 3 Copyright 2013 The Android Open Source Project 4 5 Licensed under the Apache License, Version 2.0 (the "License"); 6 you may not use this file except in compliance with the License. 7 You may obtain a copy of the License at 8 9 http://www.apache.org/licenses/LICENSE-2.0 10 11 Unless required by applicable law or agreed to in writing, software 12 distributed under the License is distributed on an "AS IS" BASIS, 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 See the License for the specific language governing permissions and 15 limitations under the License. 16--> 17 18<sample> 19 <name>LNotifications Sample</name> 20 <group>Notification</group> 21 <package>com.example.android.lnotifications</package> 22 23 <!-- change minSdk if needed--> 24 <minSdk>21</minSdk> 25 26 <dependency>com.android.support:design:28.0.0</dependency> 27 28 <strings> 29 <intro> 30 <![CDATA[ 31 This sample demonstrates how new features for notifications introduced in Android L 32 are used such as Heads-Up notifications, visibility, people, category and priority 33 metadata. (Priority metadata has been present since Jelly Bean, but actually unused). 34 ]]> 35 </intro> 36 </strings> 37 38 <template src="base"/> 39 40 <metadata> 41 <status>PUBLISHED</status> 42 <categories>Notification</categories> 43 <technologies>Android</technologies> 44 <languages>Java</languages> 45 <solutions>Mobile</solutions> 46 <level>INTERMEDIATE</level> 47 <icon>screenshots/icon-web.png</icon> 48 <screenshots> 49 <img>screenshots/1-headsup.png</img> 50 <img>screenshots/2-visibility.png</img> 51 <img>screenshots/3-others.png</img> 52 </screenshots> 53 <api_refs> 54 <android>android.app.Notification</android> 55 <android>android.app.Notification.Builder</android> 56 <android>android.app.NotificationManager</android> 57 </api_refs> 58 59 <description> 60<![CDATA[ 61This sample demonstrates new features for notifications introduced in Android L. 62These features include heads-up notifications, visibility, people, category and priority 63metadata. 64]]> 65 </description> 66 67 <intro> 68<![CDATA[ 69Android 5.0 (Lollipop, API level 21) introduced additional features to the Notification API. 70Specifically, it allows developers to specify the priority and visibility level for 71notifications. This metadata allows the system to provide enhanced security for notifications 72while the lock screen is active, allows high-priority notifications to appear even when 73the notification bar is closed, and provides users to silence low-priority notifications 74when they're busy. 75 76This metadata is provided via additional arguments to the `Notification.Builder` class. 77 78Specifically, this sample demonstrates how to generate a heads-up notification 79(`HeadsUpNotificationFragment`), how to control visibility on the lock screen 80(`VisibilityMetadataFragment`), and how to set the category, priority, and associated contact 81for a notification (`OtherMetadataFragment`). 82]]> 83 </intro> 84 </metadata> 85</sample> 86