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 <sample> 18 <name>ActiveNotifications</name> 19 <group>Notification</group> 20 <package>com.example.android.activenotifications</package> 21 22 <minSdk>24</minSdk> 23 24 <strings> 25 <intro> 26 <![CDATA[ 27 Notifications can now be grouped in Android N. Since Android M, the 28 NotificationManager can tell you how many notifications your application 29 is currently showing. This sample demonstrates how to use these APIs 30 together for a nicer user experience when an app may have multiple 31 notifications. To get started, press the "add a notification" button. 32 If you add more than one notification a notification summary will be 33 added. When a notification is being canceled, the count gets updated 34 via a PendingIntent. 35 ]]> 36 </intro> 37 </strings> 38 39 <template src="base" /> 40 <template src="FragmentView" /> 41 <common src="activities" /> 42 <common src="logger" /> 43 44 <metadata> 45 <status>PUBLISHED</status> 46 <categories>Notification</categories> 47 <technologies>Android</technologies> 48 <languages>Java</languages> 49 <solutions>Mobile</solutions> 50 <level>INTERMEDIATE</level> 51 <icon>screenshots/icon-web.png</icon> 52 <screenshots> 53 <img>screenshots/screenshot01.png</img> 54 <img>screenshots/screenshot02.png</img> 55 <img>screenshots/screenshot03.png</img> 56 </screenshots> 57 <api_refs> 58 <android>android.app.NotificationManager</android> 59 </api_refs> 60 <description> 61 <![CDATA[ 62 Notification Groups and the Notification Manager can be used together to simplify 63 how users experience notifications. This sample demonstrates how 64 the NotificationManager can tell you how many notifications your 65 application is currently showing. It also shows how to manage the 66 notifications as a group and introduce a summary for the group, when 67 supported by the platform. 68 ]]> 69 </description> 70 <intro> 71 <![CDATA[ 72 Notifications can now be grouped. 73 74 Starting with Android N, you can set notification groups for notifications 75 and define a notification group summary. 76 77 In Android M, you can query for the active notifications that your app sent 78 using the [notify][2] methods. 79 80 This sample demonstrates simple use of these features by allowing a user 81 to add notifications and then query how many notifications 82 are currently being displayed via the [getActiveNotifications()][3] method. 83 84 [1]: https://developer.android.com/reference/android/app/NotificationManager.html 85 [2]: https://developer.android.com/reference/android/app/NotificationManager.html#notify(int, android.app.Notification) 86 [3]: https://developer.android.com/reference/android/app/NotificationManager.html#getActiveNotifications() 87 ]]> 88 </intro> 89 </metadata> 90 </sample> 91