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