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<sample> 19 <name>WearHighBandwidthNetworking</name> 20 <group>Wearable</group> <!-- This field will be deprecated in the future 21 and replaced with the "categories" tags below. --> 22 <package>com.example.android.wearable.wear.wearhighbandwidthnetworking</package> 23 24 <!-- change minSdk if needed--> 25 <minSdk>24</minSdk> 26 <minSdkVersionWear>24</minSdkVersionWear> 27 <targetSdkVersion>26</targetSdkVersion> 28 <targetSdkVersionWear>26</targetSdkVersionWear> 29 <compileSdkVersionWear>26</compileSdkVersionWear> 30 <multiDexEnabled>true</multiDexEnabled> 31 32 <!-- Include additional dependencies here.--> 33 <!-- dependency>com.google.android.gms:play-services:5.0.+</dependency --> 34 <dependency_wearable>com.android.support:wear:26.0.0</dependency_wearable> 35 36 37 <strings> 38 <intro> 39 <![CDATA[ 40Sample demonstrates how to determine if a high-bandwidth network is available for use cases that 41require a minimum network bandwidth, such as streaming media or downloading large files. In 42addition, the sample demonstrates best practices for asking a user to add a new Wi-Fi network for 43high-bandwidth network operations if the bandwidth of currently available networks is inadequate. 44]]> 45 </intro> 46 </strings> 47 48 <template src="base-build" /> 49 <template src="Wear" /> 50 51 <metadata> 52 <!-- Values: {DRAFT | PUBLISHED | INTERNAL | DEPRECATED | SUPERCEDED} --> 53 <status>PUBLISHED</status> 54 <!-- See http://go/sample-categories for details on the next 4 fields. --> 55 <!-- Most samples just need to udpate the Categories field. This is a comma- 56 seperated list of topic tags. Unlike the old category system, samples 57 may have multiple categories, so feel free to add extras. Try to avoid 58 simply tagging everything with "UI". :)--> 59 <categories>Wearable</categories> 60 <technologies>Android</technologies> 61 <languages>Java</languages> 62 <solutions>Mobile</solutions> 63 <!-- Values: {BEGINNER | INTERMEDIATE | ADVANCED | EXPERT} --> 64 <!-- Beginner is for "getting started" type content, or essential content. 65 (e.g. "Hello World", activities, intents) 66 67 Intermediate is for content that covers material a beginner doesn't need 68 to know, but that a skilled developer is expected to know. 69 (e.g. services, basic styles and theming, sync adapters) 70 71 Advanced is for highly technical content geared towards experienced developers. 72 (e.g. performance optimizations, custom views, bluetooth) 73 74 Expert is reserved for highly technical or specialized content, and should 75 be used sparingly. (e.g. VPN clients, SELinux, custom instrumentation runners) --> 76 <level>INTERMEDIATE</level> 77 <!-- Dimensions: 512x512, PNG fomrat --> 78 <icon>screenshots/icon-web.png</icon> 79 <!-- Path to screenshots. Use <img> tags for each. --> 80 <screenshots> 81 <img>screenshots/wear-1.png</img> 82 <img>screenshots/wear-2.png</img> 83 <img>screenshots/wear-3.png</img> 84 </screenshots> 85 <!-- List of APIs that this sample should be cross-referenced under. Use <android> 86 for fully-qualified Framework class names ("android:" namespace). 87 88 Use <ext> for custom namespaces, if needed. See "Samples Index API" documentation 89 for more details. --> 90 <api_refs> 91 <android>android.net.ConnectivityManager</android> 92 <android>android.net.NetworkCapabilities</android> 93 <android>android.net.NetworkRequest</android> 94 </api_refs> 95 96 <!-- 1-3 line description of the sample here. 97 98 Avoid simply rearranging the sample's title. What does this sample actually 99 accomplish, and how does it do it? --> 100 <description> 101 <![CDATA[ 102Sample demonstrates how to determine if a high-bandwidth network is available for use cases that 103require a minimum network bandwidth, such as streaming media or downloading large files. In 104addition, the sample demonstrates best practices for asking a user to add a new Wi-Fi network for 105high-bandwidth network operations if the bandwidth of currently available networks is inadequate. 106]]> 107 </description> 108 109 <!-- Multi-paragraph introduction to sample, from an educational point-of-view. 110 Makrdown formatting allowed. This will be used to generate a mini-article for the 111 sample on DAC. --> 112 <intro> 113 <![CDATA[ 114On Android Wear, a high-bandwidth network is not always available, as the platform manages network 115connectivity with the goal of providing the best overall user experience, balancing network 116bandwidth and maximizing device battery life. For use cases that require high-bandwidth network 117access, such as transporting large files or streaming media, we recommend that apps: 118 1191. Check for an active network, and if there is one, check its bandwidth. 1202. If there isn't an active network, or its bandwidth is insufficient, request access to an 121unmetered Wi-Fi or cellular network. 1223. If a high-bandwidth network is still not avaiable, ask the user to connect to a new Wi-Fi 123network. 124 125You can use the [ConnectivityManager][1] class to check if an active network exists, if the active 126network has sufficient bandwidth for the desired network operation, and to request an appropriate 127high-bandwidth network. 128 129In addition to requesting a high-bandwidth network, you should also ensure that you are releasing 130bound networks and cancelling any ongoing network requests when they are no longer needed. 131 132This sample demonstrates all aspects of testing, requesting, and releasing network resources to 133ensure a high-bandwidth network is available. In addition, the sample demonstrates the ideal user 134experience for guiding the user through the process of acquiring a high-bandwidth network. 135 136To try all aspects of this sample, ensure that you have removed all saved Wi-Fi networks from your 137Wear device and that it is unplugged, as Wear devices may prefer high-bandwidth networks by default 138while plugged-in. Also, you may wish to put your phone in airplane mode or turn off Bluetooth to 139simulate the Wear device running standalone. 140 141[1]: https://developer.android.com/reference/android/net/ConnectivityManager.html 142]]> 143 </intro> 144 </metadata> 145</sample>