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