README.md
1
2 Android MessagingService Sample
3 ===================================
4
5 This sample shows a simple service that sends notifications using
6 NotificationCompat. In addition to sending a notification, it also extends
7 the notification with a CarExtender to make it compatible with Android Auto.
8 Each unread conversation from a user is sent as a distinct notification.
9
10 Introduction
11 ------------
12
13 #### Checklist while building a messaging app that supports Android Auto:
14 1. Ensure that Message notifications are extended using
15 NotificationCompat.Builder.extend(new CarExtender()...)
16 2. Declare a meta-data tag to your AndroidManifest.xml to specify that your app
17 is automotive enabled.
18
19 example: AndroidManifest.xml
20
21 ```
22 <meta-data android:name="com.google.android.gms.car.application"
23 android:resource="@xml/automotive_app_desc"/>
24 ```
25
26 Include the following to indicate that the application wants to show notifications on
27 the Android Auto overview screen.
28
29 example: res/xml/automotive\_app\_desc.xml
30 ```
31 <automotiveApp>
32 <uses name="notification"/>
33 </automotiveApp>
34 ```
35
36 #### Flow
37 MessagingFragment is shown to the user. Depending on the button clicked, the MessagingService is
38 sent a message. MessagingService in turn creates notifications which can be viewed either on the
39 device or in the messaging-simulator.
40
41 When a message is read, the associated PendingIntent is triggered and MessageReadReceiver is called
42 with the appropriate conversationId. Similarly, when a reply is received, the MessageReplyReceiver
43 is called with the appropriate conversationId. MessageLogger logs each event and shows them in a
44 TextView in MessagingFragment for correlation.
45
46 Pre-requisites
47 --------------
48
49 - Android SDK v23
50 - Android Build Tools v23.0.0
51 - Android Support Repository
52
53 Screenshots
54 -------------
55
56 <img src="screenshots/1-main.png" height="400" alt="Screenshot"/> <img src="screenshots/2-onemessage.png" height="400" alt="Screenshot"/> <img src="screenshots/3-threemessages.png" height="400" alt="Screenshot"/>
57
58 Getting Started
59 ---------------
60
61 This sample uses the Gradle build system. To build this project, use the
62 "gradlew build" command or use "Import Project" in Android Studio.
63
64 Support
65 -------
66
67 - Google+ Community: https://plus.google.com/communities/105153134372062985968
68 - Stack Overflow: http://stackoverflow.com/questions/tagged/android
69
70 If you've found an error in this sample, please file an issue:
71 https://github.com/googlesamples/android-MessagingService
72
73 Patches are encouraged, and may be submitted by forking this project and
74 submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.
75
76 License
77 -------
78
79 Copyright 2014 The Android Open Source Project, Inc.
80
81 Licensed to the Apache Software Foundation (ASF) under one or more contributor
82 license agreements. See the NOTICE file distributed with this work for
83 additional information regarding copyright ownership. The ASF licenses this
84 file to you under the Apache License, Version 2.0 (the "License"); you may not
85 use this file except in compliance with the License. You may obtain a copy of
86 the License at
87
88 http://www.apache.org/licenses/LICENSE-2.0
89
90 Unless required by applicable law or agreed to in writing, software
91 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
92 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
93 License for the specific language governing permissions and limitations under
94 the License.
95