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>WearNotifications</name> 19 <group>Wearable</group> 20 <package>com.example.android.wearable.wear.wearnotifications</package> 21 22 <minSdk>18</minSdk> 23 <compileSdkVersion>28</compileSdkVersion> 24 <targetSdkVersion>28</targetSdkVersion> 25 26 <minSdkVersionWear>23</minSdkVersionWear> 27 <compileSdkVersionWear>28</compileSdkVersionWear> 28 <targetSdkVersionWear>28</targetSdkVersionWear> 29 <multiDexEnabled>true</multiDexEnabled> 30 31 <wearable> 32 <has_handheld_app>true</has_handheld_app> 33 </wearable> 34 35 <androidX>true</androidX> 36 37 <dependency>androidx.appcompat:appcompat:1.0.2</dependency> 38 <dependency>androidx.cardview:cardview:1.0.0</dependency> 39 <dependency>com.google.android.material:material:1.0.0</dependency> 40 <dependency>androidx.legacy:legacy-support-v13:1.0.0</dependency> 41 42 <dependency_shared>androidx.legacy:legacy-support-v4:1.0.0</dependency_shared> 43 44 <dependency_wearable>androidx.appcompat:appcompat:1.0.2</dependency_wearable> 45 <dependency_wearable>androidx.wear:wear:1.0.0</dependency_wearable> 46 <dependency_wearable>com.google.android.material:material:1.0.0</dependency_wearable> 47 <dependency_wearable>androidx.legacy:legacy-support-v13:1.0.0</dependency_wearable> 48 49 <!-- Include additional dependencies here.--> 50 <!-- dependency>com.google.android.gms:play-services:5.0.+</dependency --> 51 52 <strings> 53 <intro> 54 <![CDATA[ 55 Sample demonstrates best practices for Notification Styles that support Android 56 phone/tablets and Wear. The phone app demonstrates best practices if you 57 do not have a dedicated Wear app for Notifications. While the Wear app 58 demonstrates best practices for a standalone Wear Notification experience without 59 the Notifications showing on the phone/tablet. 60 ]]> 61 </intro> 62 </strings> 63 64 <template src="base" /> 65 <template src="WearPlusShared" /> 66 67 <metadata> 68 <!-- Values: {DRAFT | PUBLISHED | INTERNAL | DEPRECATED | SUPERCEDED} --> 69 <status>PUBLISHED</status> 70 <!-- See http://go/sample-categories for details on the next 4 fields. --> 71 <!-- Most samples just need to udpate the Categories field. This is a comma- 72 seperated list of topic tags. Unlike the old category system, samples 73 may have multiple categories, so feel free to add extras. Try to avoid 74 simply tagging everything with "UI". :)--> 75 <categories>Notification, Wearable</categories> 76 <technologies>Android</technologies> 77 <languages>Java</languages> 78 <solutions>Mobile</solutions> 79 <!-- Values: {BEGINNER | INTERMEDIATE | ADVANCED | EXPERT} --> 80 <!-- Beginner is for "getting started" type content, or essential content. 81 (e.g. "Hello World", activities, intents) 82 83 Intermediate is for content that covers material a beginner doesn't need 84 to know, but that a skilled developer is expected to know. 85 (e.g. services, basic styles and theming, sync adapters) 86 87 Advanced is for highly technical content geared towards experienced developers. 88 (e.g. performance optimizations, custom views, bluetooth) 89 90 Expert is reserved for highly technical or specialized content, and should 91 be used sparingly. (e.g. VPN clients, SELinux, custom instrumentation runners) --> 92 <level>INTERMEDIATE</level> 93 <!-- Dimensions: 512x512, PNG fomrat --> 94 <icon>screenshots/icon-web.png</icon> 95 <!-- Path to screenshots. Use <img> tags for each. --> 96 <screenshots> 97 <img>screenshots/mobile-1.png</img> 98 <img>screenshots/mobile-2.png</img> 99 <img>screenshots/wear-1.png</img> 100 <img>screenshots/wear-2.png</img> 101 </screenshots> 102 <!-- List of APIs that this sample should be cross-referenced under. Use <android> 103 for fully-qualified Framework class names ("android:" namespace). 104 105 Use <ext> for custom namespaces, if needed. See "Samples Index API" documentation 106 for more details. --> 107 <api_refs> 108 <android>android.app.Notification</android> 109 <android>android.support.v4.app.NotificationCompat.BigPictureStyle</android> 110 <android>android.support.v4.app.NotificationCompat.BigTextStyle</android> 111 <android>android.support.v4.app.NotificationCompat.InboxStyle</android> 112 <android>android.support.v4.app.NotificationCompat.MessagingStyle</android> 113 <android>android.support.v4.app.NotificationManagerCompat</android> 114 <android>android.support.v4.app.RemoteInput</android> 115 <android>android.support.v4.app.TaskStackBuilder</android> 116 <android>android.support.v7.app.AppCompatActivity</android> 117 <android>android.support.v7.app.NotificationCompat</android> 118 </api_refs> 119 120 <!-- 1-3 line description of the sample here. 121 122 Avoid simply rearranging the sample's title. What does this sample actually 123 accomplish, and how does it do it? --> 124 <description> 125 Sample demonstrates best practices for using NotificationStyle Notifications (Inbox, 126 BigPicture, BigText, and Messaging) for both Mobile apps and native/local Wear 127 apps. It also covers Notifications on Wear 1.+ and Wear 2.0. 128 </description> 129 130 <!-- Multi-paragraph introduction to sample, from an educational point-of-view. 131 Makrdown formatting allowed. This will be used to generate a mini-article for the 132 sample on DAC. --> 133 <intro> 134<![CDATA[ 135Steps for trying out the sample: 136* Compile and install the mobile app onto your mobile device or emulator (for mobile 137scenario). 138* Compile and install the wearable app onto your Wear device or emulator (for Wear 139scenario). 140 141This sample demonstrate best practices for using [NotificationStyle][1] 142[Notifications][2] for two scenarios: 143 1441. Launching Notifications from a Mobile app WITHOUT a native Wear app. 145Notifications appear both on mobile and Wear (bridged to appear like a local/native 146Wear app). 147 1482. Launching Notifications from a Native/Local Wear app. Notifications only 149appear on Wear device. 150 151The Mobile and Wear apps demonstrate [BigTextStyle][3], [BigPictureStyle][4], 152[InboxStyle][5], and [MessagingStyle][6] Notifications. 153 154Although there are two apps (Mobile and Wear) running, each should be looked at as a 155separate experience. That is, neither app uses nor relies on the other. 156 157They are packaged together simply to show both scenarios in one easy sample. 158 159Both apps also cover the Notifications being displayed on Wear 1.+ and/or Wear 2.0 and 160using some of the new features of Wear 2.0 (inline actions). 161 162[1]: https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Style.html 163[2]: https://developer.android.com/reference/android/support/v4/app/NotificationCompat.html 164[3]: https://developer.android.com/reference/android/support/v4/app/NotificationCompat.BigTextStyle.html 165[4]: https://developer.android.com/reference/android/support/v4/app/NotificationCompat.BigPictureStyle.html 166[5]: https://developer.android.com/reference/android/support/v4/app/NotificationCompat.InboxStyle.html 167[6]: https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.html 168]]> 169 </intro> 170 </metadata> 171</sample> 172