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