1*d353a188SXin Li 2*d353a188SXin LiAndroid WearHighBandwidthNetworking Sample 3*d353a188SXin Li=================================== 4*d353a188SXin Li 5*d353a188SXin LiSample demonstrates how to determine if a high-bandwidth network is available for use cases that 6*d353a188SXin Lirequire a minimum network bandwidth, such as streaming media or downloading large files. In 7*d353a188SXin Liaddition, the sample demonstrates best practices for asking a user to add a new Wi-Fi network for 8*d353a188SXin Lihigh-bandwidth network operations if the bandwidth of currently available networks is inadequate. 9*d353a188SXin Li 10*d353a188SXin LiIntroduction 11*d353a188SXin Li------------ 12*d353a188SXin Li 13*d353a188SXin LiOn Android Wear, a high-bandwidth network is not always available, as the platform manages network 14*d353a188SXin Liconnectivity with the goal of providing the best overall user experience, balancing network 15*d353a188SXin Libandwidth and maximizing device battery life. For use cases that require high-bandwidth network 16*d353a188SXin Liaccess, such as transporting large files or streaming media, we recommend that apps: 17*d353a188SXin Li 18*d353a188SXin Li1. Check for an active network, and if there is one, check its bandwidth. 19*d353a188SXin Li2. If there isn't an active network, or its bandwidth is insufficient, request access to an 20*d353a188SXin Liunmetered Wi-Fi or cellular network. 21*d353a188SXin Li3. If a high-bandwidth network is still not avaiable, ask the user to connect to a new Wi-Fi 22*d353a188SXin Linetwork. 23*d353a188SXin Li 24*d353a188SXin LiYou can use the [ConnectivityManager][1] class to check if an active network exists, if the active 25*d353a188SXin Linetwork has sufficient bandwidth for the desired network operation, and to request an appropriate 26*d353a188SXin Lihigh-bandwidth network. 27*d353a188SXin Li 28*d353a188SXin LiIn addition to requesting a high-bandwidth network, you should also ensure that you are releasing 29*d353a188SXin Libound networks and cancelling any ongoing network requests when they are no longer needed. 30*d353a188SXin Li 31*d353a188SXin LiThis sample demonstrates all aspects of testing, requesting, and releasing network resources to 32*d353a188SXin Liensure a high-bandwidth network is available. In addition, the sample demonstrates the ideal user 33*d353a188SXin Liexperience for guiding the user through the process of acquiring a high-bandwidth network. 34*d353a188SXin Li 35*d353a188SXin LiTo try all aspects of this sample, ensure that you have removed all saved Wi-Fi networks from your 36*d353a188SXin LiWear device and that it is unplugged, as Wear devices may prefer high-bandwidth networks by default 37*d353a188SXin Liwhile plugged-in. Also, you may wish to put your phone in airplane mode or turn off Bluetooth to 38*d353a188SXin Lisimulate the Wear device running standalone. 39*d353a188SXin Li 40*d353a188SXin Li[1]: https://developer.android.com/reference/android/net/ConnectivityManager.html 41*d353a188SXin Li 42*d353a188SXin LiPre-requisites 43*d353a188SXin Li-------------- 44*d353a188SXin Li 45*d353a188SXin Li- Android SDK 27 46*d353a188SXin Li- Android Build Tools v27.0.2 47*d353a188SXin Li- Android Support Repository 48*d353a188SXin Li 49*d353a188SXin LiScreenshots 50*d353a188SXin Li------------- 51*d353a188SXin Li 52*d353a188SXin Li<img src="screenshots/wear-1.png" height="400" alt="Screenshot"/> <img src="screenshots/wear-2.png" height="400" alt="Screenshot"/> <img src="screenshots/wear-3.png" height="400" alt="Screenshot"/> 53*d353a188SXin Li 54*d353a188SXin LiGetting Started 55*d353a188SXin Li--------------- 56*d353a188SXin Li 57*d353a188SXin LiThis sample uses the Gradle build system. To build this project, use the 58*d353a188SXin Li"gradlew build" command or use "Import Project" in Android Studio. 59*d353a188SXin Li 60*d353a188SXin LiSupport 61*d353a188SXin Li------- 62*d353a188SXin Li 63*d353a188SXin Li- Google+ Community: https://plus.google.com/communities/105153134372062985968 64*d353a188SXin Li- Stack Overflow: http://stackoverflow.com/questions/tagged/android 65*d353a188SXin Li 66*d353a188SXin LiIf you've found an error in this sample, please file an issue: 67*d353a188SXin Lihttps://github.com/googlesamples/android-WearHighBandwidthNetworking 68*d353a188SXin Li 69*d353a188SXin LiPatches are encouraged, and may be submitted by forking this project and 70*d353a188SXin Lisubmitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. 71*d353a188SXin Li 72*d353a188SXin LiLicense 73*d353a188SXin Li------- 74*d353a188SXin Li 75*d353a188SXin LiCopyright 2017 The Android Open Source Project, Inc. 76*d353a188SXin Li 77*d353a188SXin LiLicensed to the Apache Software Foundation (ASF) under one or more contributor 78*d353a188SXin Lilicense agreements. See the NOTICE file distributed with this work for 79*d353a188SXin Liadditional information regarding copyright ownership. The ASF licenses this 80*d353a188SXin Lifile to you under the Apache License, Version 2.0 (the "License"); you may not 81*d353a188SXin Liuse this file except in compliance with the License. You may obtain a copy of 82*d353a188SXin Lithe License at 83*d353a188SXin Li 84*d353a188SXin Lihttp://www.apache.org/licenses/LICENSE-2.0 85*d353a188SXin Li 86*d353a188SXin LiUnless required by applicable law or agreed to in writing, software 87*d353a188SXin Lidistributed under the License is distributed on an "AS IS" BASIS, WITHOUT 88*d353a188SXin LiWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 89*d353a188SXin LiLicense for the specific language governing permissions and limitations under 90*d353a188SXin Lithe License. 91