Home | History | Annotate | only in /developers/build/prebuilts/gradle/NetworkConnect
Up to higher level directory
NameDateSize
.google/21-Aug-2018
Application/21-Aug-2018
build.gradle21-Aug-201810
CONTRIB.md21-Aug-20181.6K
CONTRIBUTING.md21-Aug-20181.5K
gradle/21-Aug-2018
gradlew21-Aug-20185K
gradlew.bat21-Aug-20182.3K
LICENSE21-Aug-201811.1K
packaging.yaml21-Aug-2018494
README.md21-Aug-20183.1K
screenshots/21-Aug-2018
settings.gradle21-Aug-201822

README.md

      1 
      2 Android NetworkConnect Sample
      3 ===================================
      4 
      5 This sample demonstrates how to connect to the network and fetch raw HTML using
      6 HttpsURLConnection. AsyncTask is used to perform the fetch on a background thread.
      7 
      8 Introduction
      9 ------------
     10 
     11 This sample demonstrates how to connect to the network and fetch raw HTML using
     12 [`HttpsURLConnection`][4]. Since API 11, it is required by default that all network
     13 operations run on a background thread in order to avoid hanging on the UI thread. Only
     14 when the network response is ready should the work return to the main thread to update
     15 the UI. An [`AsyncTask`][3] is a viable background task manager that is used to perform
     16 the network operation and return to the UI thread upon completion.
     17 
     18 The sample also utilizes the [`ConnectivityManager`][1] to determine if you have
     19 a network connection, and if so, what type of connection it is.
     20 
     21 Using an [`AsyncTaskLoader`][6] or an [`IntentService`][5] are two common alternatives
     22 for managing longer running background work.
     23 
     24 [1]: https://developer.android.com/reference/android/net/ConnectivityManager.html
     25 [2]: https://developer.android.com/reference/android/net/NetworkInfo.html
     26 [3]: https://developer.android.com/reference/android/os/AsyncTask.html
     27 [4]: https://developer.android.com/reference/javax/net/ssl/HttpsURLConnection.html
     28 [5]: https://developer.android.com/reference/android/app/IntentService.html
     29 [6]: https://developer.android.com/reference/android/content/AsyncTaskLoader.html
     30 
     31 Pre-requisites
     32 --------------
     33 
     34 - Android SDK 27
     35 - Android Build Tools v27.0.2
     36 - Android Support Repository
     37 
     38 Screenshots
     39 -------------
     40 
     41 <img src="screenshots/main.png" height="400" alt="Screenshot"/> 
     42 
     43 Getting Started
     44 ---------------
     45 
     46 This sample uses the Gradle build system. To build this project, use the
     47 "gradlew build" command or use "Import Project" in Android Studio.
     48 
     49 Support
     50 -------
     51 
     52 - Google+ Community: https://plus.google.com/communities/105153134372062985968
     53 - Stack Overflow: http://stackoverflow.com/questions/tagged/android
     54 
     55 If you've found an error in this sample, please file an issue:
     56 https://github.com/googlesamples/android-NetworkConnect
     57 
     58 Patches are encouraged, and may be submitted by forking this project and
     59 submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.
     60 
     61 License
     62 -------
     63 
     64 Copyright 2017 The Android Open Source Project, Inc.
     65 
     66 Licensed to the Apache Software Foundation (ASF) under one or more contributor
     67 license agreements.  See the NOTICE file distributed with this work for
     68 additional information regarding copyright ownership.  The ASF licenses this
     69 file to you under the Apache License, Version 2.0 (the "License"); you may not
     70 use this file except in compliance with the License.  You may obtain a copy of
     71 the License at
     72 
     73 http://www.apache.org/licenses/LICENSE-2.0
     74 
     75 Unless required by applicable law or agreed to in writing, software
     76 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
     77 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
     78 License for the specific language governing permissions and limitations under
     79 the License.
     80