Home | History | Annotate | Download | only in MessagingService
      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[
     27 This sample shows a simple service that sends notifications using
     28 NotificationCompat. In addition to sending a notification, it also extends
     29 the notification with a CarExtender to make it compatible with Android Auto.
     30 Each unread conversation from a user is sent as a distinct notification.
     31             ]]>
     32         </intro>
     33     </strings>
     34 
     35     <template src="base-build" />
     36     <template src="base-application" />
     37     <metadata>
     38         <status>PUBLISHED</status>
     39         <categories>UI, Notification</categories>
     40         <technologies>Android</technologies>
     41         <languages>Java</languages>
     42         <solutions>Mobile</solutions>
     43         <level>ADVANCED</level>
     44         <icon>screenshots/icon-web.png</icon>
     45         <screenshots>
     46             <img>screenshots/1-main.png</img>
     47             <img>screenshots/2-onemessage.png</img>
     48             <img>screenshots/3-threemessages.png</img>
     49         </screenshots>
     50         <api_refs>
     51             <android>android.app.Service</android>
     52             <android>android.content.Intent</android>
     53             <android>android.support.v4.app.NotificationCompat</android>
     54             <android>android.support.v4.app.NotificationCompat.CarExtender</android>
     55         </api_refs>
     56         <description>
     57 <![CDATA[
     58 This sample shows a simple service that sends notifications using
     59 NotificationCompat. In addition to sending a notification, it also extends
     60 the notification with a CarExtender to make it compatible with Android Auto.
     61 Each unread conversation from a user is sent as a distinct notification.
     62 ]]></description>
     63         <intro>
     64             <![CDATA[
     65 #### Checklist while building a messaging app that supports Android Auto:
     66 1. Ensure that Message notifications are extended using
     67 NotificationCompat.Builder.extend(new CarExtender()...)
     68 2. Declare a meta-data tag to your AndroidManifest.xml to specify that your app
     69 is automotive enabled.
     70 
     71 example: AndroidManifest.xml
     72 
     73 ```
     74        <meta-data android:name="com.google.android.gms.car.application"
     75                    android:resource="@xml/automotive_app_desc"/>
     76 ```
     77 
     78 Include the following to indicate that the application wants to show notifications on
     79 the Android Auto overview screen.
     80 
     81 example: res/xml/automotive\_app\_desc.xml
     82 ```
     83         <automotiveApp>
     84             <uses name="notification"/>
     85         </automotiveApp>
     86 ```
     87 
     88 #### Flow
     89 MessagingFragment is shown to the user. Depending on the button clicked, the MessagingService is
     90 sent a message. MessagingService in turn creates notifications which can be viewed either on the
     91 device or in the messaging-simulator.
     92 
     93 When a message is read, the associated PendingIntent is triggered and MessageReadReceiver is called
     94 with the appropriate conversationId. Similarly, when a reply is received, the MessageReplyReceiver
     95 is called with the appropriate conversationId. MessageLogger logs each event and shows them in a
     96 TextView in MessagingFragment for correlation.
     97 ]]>
     98         </intro>
     99     </metadata>
    100 </sample>
    101