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 <sample> 18 <name>BasicNetworking</name> 19 <group>Connectivity</group> 20 <package>com.example.android.basicnetworking</package> 21 22 <!-- change minSdk if needed--> 23 <minSdk>7</minSdk> 24 25 <strings> 26 <intro> 27 <![CDATA[ 28 This sample demonstrates how to use the ConnectivityManager to determine if you have 29 a network connection, and if so, what type of connection it is. 30 \n\nA "NetworkInfo" object is retrieved from the ConnectivityManager, which contains information 31 on the active connection, and then the connection type is printed to an on-screen console. 32 ]]> 33 </intro> 34 </strings> 35 36 <template src="base"/> 37 <common src="logger"/> 38 <metadata> 39 <status>PUBLISHED</status> 40 <categories>Connectivity</categories> 41 <technologies>Android</technologies> 42 <languages>Java</languages> 43 <solutions>Mobile</solutions> 44 <level>INTERMEDIATE</level> 45 <icon>screenshots/big_icon.png</icon> 46 <screenshots> 47 <img>screenshots/start.png</img> 48 <img>screenshots/tested.png</img> 49 </screenshots> 50 <api_refs> 51 <android>android.net.ConnectivityManager</android> 52 <android>android.net.NetworkInfo</android> 53 </api_refs> 54 <description> 55 <![CDATA[ 56 This sample demonstrates how to check network connectivity with Android APIs. 57 ]]> 58 </description> 59 <intro> 60 <![CDATA[ 61 It utilizes the [`ConnectivityManager`][1] to determine if you have 62 a network connection, and if so, what type of connection it is. 63 64 A [`NetworkInfo`][2] object is retrieved from the ConnectivityManager, which contains information 65 on the active connection, and then the connection type is printed to an on-screen console. 66 67 Multiple types of connectivity can be displayed and could be used to take different measures 68 in actual production code. 69 70 [1]: https://developer.android.com/reference/android/net/ConnectivityManager.html 71 [2]: https://developer.android.com/reference/android/net/NetworkInfo.html 72 ]]> 73 </intro> 74 </metadata> 75 </sample> 76