xref: /aosp_15_r20/developers/build/prebuilts/gradle/WearNotifications/README.md (revision d353a188ca6ec4b5eba25b5fbd7bcb8ce61322fb)
1*d353a188SXin Li
2*d353a188SXin LiAndroid WearNotifications Sample
3*d353a188SXin Li===================================
4*d353a188SXin Li
5*d353a188SXin LiSample demonstrates best practices for using NotificationStyle Notifications (Inbox,
6*d353a188SXin Li            BigPicture, BigText, and Messaging) for both Mobile apps and native/local Android Wear
7*d353a188SXin Li            apps. It also covers Notifications on Wear 1.+ and Wear 2.0.
8*d353a188SXin Li
9*d353a188SXin LiIntroduction
10*d353a188SXin Li------------
11*d353a188SXin Li
12*d353a188SXin LiSteps for trying out the sample:
13*d353a188SXin Li* Compile and install the mobile app onto your mobile device or emulator (for mobile
14*d353a188SXin Liscenario).
15*d353a188SXin Li* Compile and install the wearable app onto your Wear device or emulator (for Wear
16*d353a188SXin Liscenario).
17*d353a188SXin Li
18*d353a188SXin LiThis sample demonstrate best practices for using [NotificationStyle][1]
19*d353a188SXin Li[Notifications][2] for two scenarios:
20*d353a188SXin Li
21*d353a188SXin Li1. Launching Notifications from a Mobile app WITHOUT a native Android Wear app.
22*d353a188SXin LiNotifications appear both on mobile and Wear (bridged to appear like a local/native
23*d353a188SXin LiWear app).
24*d353a188SXin Li
25*d353a188SXin Li2. Launching Notifications from a Native/Local Android Wear app. Notifications only
26*d353a188SXin Liappear on Wear device.
27*d353a188SXin Li
28*d353a188SXin LiThe Mobile and Wear apps demonstrate [BigTextStyle][3], [BigPictureStyle][4],
29*d353a188SXin Li[InboxStyle][5], and [MessagingStyle][6] Notifications.
30*d353a188SXin Li
31*d353a188SXin LiAlthough there are two apps (Mobile and Wear) running, each should be looked at as a
32*d353a188SXin Liseparate experience. That is, neither app uses nor relies on the other.
33*d353a188SXin Li
34*d353a188SXin LiThey are packaged together simply to show both scenarios in one easy sample.
35*d353a188SXin Li
36*d353a188SXin LiBoth apps also cover the Notifications being displayed on Wear 1.+ and/or Wear 2.0 and
37*d353a188SXin Liusing some of the new features of Wear 2.0 (inline actions).
38*d353a188SXin Li
39*d353a188SXin Li[1]: https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Style.html
40*d353a188SXin Li[2]: https://developer.android.com/reference/android/support/v4/app/NotificationCompat.html
41*d353a188SXin Li[3]: https://developer.android.com/reference/android/support/v4/app/NotificationCompat.BigTextStyle.html
42*d353a188SXin Li[4]: https://developer.android.com/reference/android/support/v4/app/NotificationCompat.BigPictureStyle.html
43*d353a188SXin Li[5]: https://developer.android.com/reference/android/support/v4/app/NotificationCompat.InboxStyle.html
44*d353a188SXin Li[6]: https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.html
45*d353a188SXin Li
46*d353a188SXin LiPre-requisites
47*d353a188SXin Li--------------
48*d353a188SXin Li
49*d353a188SXin Li- Android SDK 26
50*d353a188SXin Li- Android Build Tools v27.0.2
51*d353a188SXin Li- Android Support Repository
52*d353a188SXin Li
53*d353a188SXin LiScreenshots
54*d353a188SXin Li-------------
55*d353a188SXin Li
56*d353a188SXin Li<img src="screenshots/mobile-1.png" height="400" alt="Screenshot"/> <img src="screenshots/mobile-2.png" height="400" alt="Screenshot"/> <img src="screenshots/wear-1.png" height="400" alt="Screenshot"/> <img src="screenshots/wear-2.png" height="400" alt="Screenshot"/>
57*d353a188SXin Li
58*d353a188SXin LiGetting Started
59*d353a188SXin Li---------------
60*d353a188SXin Li
61*d353a188SXin LiThis sample uses the Gradle build system. To build this project, use the
62*d353a188SXin Li"gradlew build" command or use "Import Project" in Android Studio.
63*d353a188SXin Li
64*d353a188SXin LiSupport
65*d353a188SXin Li-------
66*d353a188SXin Li
67*d353a188SXin Li- Google+ Community: https://plus.google.com/communities/105153134372062985968
68*d353a188SXin Li- Stack Overflow: http://stackoverflow.com/questions/tagged/android
69*d353a188SXin Li
70*d353a188SXin LiIf you've found an error in this sample, please file an issue:
71*d353a188SXin Lihttps://github.com/googlesamples/android-WearNotifications
72*d353a188SXin Li
73*d353a188SXin LiPatches are encouraged, and may be submitted by forking this project and
74*d353a188SXin Lisubmitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.
75*d353a188SXin Li
76*d353a188SXin LiLicense
77*d353a188SXin Li-------
78*d353a188SXin Li
79*d353a188SXin LiCopyright 2017 The Android Open Source Project, Inc.
80*d353a188SXin Li
81*d353a188SXin LiLicensed to the Apache Software Foundation (ASF) under one or more contributor
82*d353a188SXin Lilicense agreements.  See the NOTICE file distributed with this work for
83*d353a188SXin Liadditional information regarding copyright ownership.  The ASF licenses this
84*d353a188SXin Lifile to you under the Apache License, Version 2.0 (the "License"); you may not
85*d353a188SXin Liuse this file except in compliance with the License.  You may obtain a copy of
86*d353a188SXin Lithe License at
87*d353a188SXin Li
88*d353a188SXin Lihttp://www.apache.org/licenses/LICENSE-2.0
89*d353a188SXin Li
90*d353a188SXin LiUnless required by applicable law or agreed to in writing, software
91*d353a188SXin Lidistributed under the License is distributed on an "AS IS" BASIS, WITHOUT
92*d353a188SXin LiWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
93*d353a188SXin LiLicense for the specific language governing permissions and limitations under
94*d353a188SXin Lithe License.
95