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>MessagingService</name>
19    <group>Notification</group>
20    <package>com.example.android.messagingservice</package>
21
22    <minSdk>21</minSdk>
23
24    <strings>
25        <intro>
26            <![CDATA[
27This sample shows a simple service that sends notifications using
28NotificationCompat. It also extends the notification with Remote
29Input to allow Android N devices to reply via text directly from
30the notification without having to open an app. The same Remote
31Input usage also allows Android Auto users to respond by voice
32when the notifications is presented in that experience.
33Note: Each unread conversation from a user is sent as a distinct
34notification.
35            ]]>
36        </intro>
37    </strings>
38
39    <template src="base-build" />
40    <template src="base-application" />
41    <metadata>
42        <status>PUBLISHED</status>
43        <categories>Notification</categories>
44        <!-- Old Categories: UI, Notification -->
45        <technologies>Android</technologies>
46        <languages>Java</languages>
47        <solutions>Mobile</solutions>
48        <level>ADVANCED</level>
49        <icon>screenshots/icon-web.png</icon>
50        <screenshots>
51            <img>screenshots/1-main.png</img>
52            <img>screenshots/2-onemessage.png</img>
53            <img>screenshots/3-threemessages.png</img>
54        </screenshots>
55        <api_refs>
56            <android>android.app.Service</android>
57            <android>android.content.Intent</android>
58            <android>android.support.v4.app.NotificationCompat</android>
59            <android>android.support.v4.app.NotificationCompat.CarExtender</android>
60        </api_refs>
61        <description>
62<![CDATA[
63This sample shows a simple service that sends notifications using
64NotificationCompat. It also extends the notification with Remote
65Input to allow Android N devices to reply via text directly from
66the notification without having to open an App. The same Remote
67Input object also allows Android Auto users to respond by voice
68when the notification is presented there.
69Note: Each unread conversation from a user is sent as a distinct
70notification.
71]]></description>
72        <intro>
73            <![CDATA[
74#### Checklist while building a messaging app that supports Android Auto:
751. Ensure that Message notifications are extended using
76NotificationCompat.Builder.extend(new CarExtender()...)
772. Declare a meta-data tag to your AndroidManifest.xml to specify that your app
78is automotive enabled.
79
80example: AndroidManifest.xml
81
82```
83       <meta-data android:name="com.google.android.gms.car.application"
84                   android:resource="@xml/automotive_app_desc"/>
85```
86
87Include the following to indicate that the application wants to show notifications on
88the Android Auto overview screen.
89
90example: res/xml/automotive\_app\_desc.xml
91```
92        <automotiveApp>
93            <uses name="notification"/>
94        </automotiveApp>
95```
96
97#### Flow
98MessagingFragment is shown to the user. Depending on the button clicked, the MessagingService is
99sent a message. MessagingService in turn creates notifications which can be viewed either on the
100device or in the messaging-simulator.
101
102When a message is read, the associated PendingIntent is triggered and MessageReadReceiver is called
103with the appropriate conversationId. Similarly, when a reply is received, the MessageReplyReceiver
104is called with the appropriate conversationId. MessageLogger logs each event and shows them in a
105TextView in MessagingFragment for correlation.
106]]>
107        </intro>
108    </metadata>
109</sample>
110