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 18 19 20 <sample> 21 <name>EmbeddedApp</name> 22 <group>Wearable</group> 23 <package>com.example.android.wearable.embeddedapp</package> 24 25 <minSdk>18</minSdk> 26 <targetSdkVersion>22</targetSdkVersion> 27 28 <wearable> 29 <has_handheld_app>true</has_handheld_app> 30 </wearable> 31 32 <strings> 33 <intro> 34 <![CDATA[ 35 This simple app demonstrates how to embed a wearable app into a phone app. 36 ]]> 37 </intro> 38 </strings> 39 40 <template src="base"/> 41 <template src="Wear"/> 42 43 <metadata> 44 <status>PUBLISHED</status> 45 <categories>Wearable</categories> 46 <technologies>Android</technologies> 47 <languages>Java</languages> 48 <solutions>Mobile</solutions> 49 <level>BEGINNER</level> 50 <icon>src/main/res/drawable-xxhdpi/ic_launcher.png</icon> 51 <screenshots> 52 <img>screenshots/embedded_wearable_app.png</img> 53 <img>screenshots/phone_app.png</img> 54 </screenshots> 55 <api_refs> 56 <android>android.app.Activity</android> 57 </api_refs> 58 59 <description> 60 <![CDATA[ 61 This simple app demonstrates how to embed a wearable app into a phone app. 62 ]]> 63 </description> 64 65 <intro> 66 <![CDATA[ 67 Wearable apps can be installed directly onto Android Wear devices during development, using either a direct ADB 68 connection or ADB-over-Bluetooth. However, when releasing your app to end users, you must package your 69 wearable APK inside of a traditional APK for distribution via a paired phone. 70 71 When end users install this APK onto their phone, the wearable APK will be automatically detected, extracted, and pushed 72 to their any paired wearable devices. 73 74 This sample demonstrates how to properly package a wearable app for release in this manner. The wearable app is inside 75 the `Wearable` directory, and the phone app (which will be used as a container for distribution) is the `Application` 76 directory. There is nothing special about these apps, other than the `wearApp` dependency in the (host) phone app's 77 `build.gradle` file: 78 79 ```groovy 80 dependencies { 81 compile 'com.google.android.gms:play-services-wearable:6.5.+' 82 wearApp project(':Wearable') 83 } 84 ``` 85 86 This dependency will automatically package the wearable APK during a **release build** (e.g. using the "Build > Generate 87 Signed APK..." command in Android Studio). Note that this packaging is **not** performed for debug builds for 88 performance reasons. During development, your wearable and phone apps must still be pushed individually to their 89 respective devices using an ADB connection. 90 ]]> 91 </intro> 92 </metadata> 93 </sample> 94