blob: 2437325265473a1ca92aa8ae4a9fd61662b21763 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<sample>
<name>WearHighBandwidthNetworking</name>
<group>Wearable</group> <!-- This field will be deprecated in the future
and replaced with the "categories" tags below. -->
<package>com.example.android.wearable.wear.wearhighbandwidthnetworking</package>
<!-- change minSdk if needed-->
<minSdk>24</minSdk>
<minSdkVersionWear>24</minSdkVersionWear>
<targetSdkVersion>26</targetSdkVersion>
<targetSdkVersionWear>26</targetSdkVersionWear>
<multiDexEnabled>true</multiDexEnabled>
<!-- Include additional dependencies here.-->
<!-- dependency>com.google.android.gms:play-services:5.0.+</dependency -->
<dependency_wearable>com.android.support:wear:27.1.1</dependency_wearable>
<strings>
<intro>
<![CDATA[
Sample demonstrates how to determine if a high-bandwidth network is available for use cases that
require a minimum network bandwidth, such as streaming media or downloading large files. In
addition, the sample demonstrates best practices for asking a user to add a new Wi-Fi network for
high-bandwidth network operations if the bandwidth of currently available networks is inadequate.
]]>
</intro>
</strings>
<template src="base-build" />
<template src="Wear" />
<metadata>
<!-- Values: {DRAFT | PUBLISHED | INTERNAL | DEPRECATED | SUPERCEDED} -->
<status>PUBLISHED</status>
<!-- See http://go/sample-categories for details on the next 4 fields. -->
<!-- Most samples just need to udpate the Categories field. This is a comma-
seperated list of topic tags. Unlike the old category system, samples
may have multiple categories, so feel free to add extras. Try to avoid
simply tagging everything with "UI". :)-->
<categories>Wearable</categories>
<technologies>Android</technologies>
<languages>Java</languages>
<solutions>Mobile</solutions>
<!-- Values: {BEGINNER | INTERMEDIATE | ADVANCED | EXPERT} -->
<!-- Beginner is for "getting started" type content, or essential content.
(e.g. "Hello World", activities, intents)
Intermediate is for content that covers material a beginner doesn't need
to know, but that a skilled developer is expected to know.
(e.g. services, basic styles and theming, sync adapters)
Advanced is for highly technical content geared towards experienced developers.
(e.g. performance optimizations, custom views, bluetooth)
Expert is reserved for highly technical or specialized content, and should
be used sparingly. (e.g. VPN clients, SELinux, custom instrumentation runners) -->
<level>INTERMEDIATE</level>
<!-- Dimensions: 512x512, PNG fomrat -->
<icon>screenshots/icon-web.png</icon>
<!-- Path to screenshots. Use <img> tags for each. -->
<screenshots>
<img>screenshots/wear-1.png</img>
<img>screenshots/wear-2.png</img>
<img>screenshots/wear-3.png</img>
</screenshots>
<!-- List of APIs that this sample should be cross-referenced under. Use <android>
for fully-qualified Framework class names ("android:" namespace).
Use <ext> for custom namespaces, if needed. See "Samples Index API" documentation
for more details. -->
<api_refs>
<android>android.net.ConnectivityManager</android>
<android>android.net.NetworkCapabilities</android>
<android>android.net.NetworkRequest</android>
</api_refs>
<!-- 1-3 line description of the sample here.
Avoid simply rearranging the sample's title. What does this sample actually
accomplish, and how does it do it? -->
<description>
<![CDATA[
Sample demonstrates how to determine if a high-bandwidth network is available for use cases that
require a minimum network bandwidth, such as streaming media or downloading large files. In
addition, the sample demonstrates best practices for asking a user to add a new Wi-Fi network for
high-bandwidth network operations if the bandwidth of currently available networks is inadequate.
]]>
</description>
<!-- Multi-paragraph introduction to sample, from an educational point-of-view.
Makrdown formatting allowed. This will be used to generate a mini-article for the
sample on DAC. -->
<intro>
<![CDATA[
On Wear, a high-bandwidth network is not always available, as the platform manages
network connectivity with the goal of providing the best overall user experience, balancing network
bandwidth and maximizing device battery life. For use cases that require high-bandwidth network
access, such as transporting large files or streaming media, we recommend that apps:
1. Check for an active network, and if there is one, check its bandwidth.
2. If there isn't an active network, or its bandwidth is insufficient, request access to an
unmetered Wi-Fi or cellular network.
3. If a high-bandwidth network is still not avaiable, ask the user to connect to a new Wi-Fi
network.
You can use the [ConnectivityManager][1] class to check if an active network exists, if the active
network has sufficient bandwidth for the desired network operation, and to request an appropriate
high-bandwidth network.
In addition to requesting a high-bandwidth network, you should also ensure that you are releasing
bound networks and cancelling any ongoing network requests when they are no longer needed.
This sample demonstrates all aspects of testing, requesting, and releasing network resources to
ensure a high-bandwidth network is available. In addition, the sample demonstrates the ideal user
experience for guiding the user through the process of acquiring a high-bandwidth network.
To try all aspects of this sample, ensure that you have removed all saved Wi-Fi networks from your
Wear device and that it is unplugged, as Wear devices may prefer high-bandwidth networks by default
while plugged-in. Also, you may wish to put your phone in airplane mode or turn off Bluetooth to
simulate the Wear device running standalone.
[1]: https://developer.android.com/reference/android/net/ConnectivityManager.html
]]>
</intro>
</metadata>
</sample>