To integrate an Android app with a RESTful web service, you'll need to make calls over the network. You can choose from a few different HTTP clients, some that are included with the Android SDK, and some open-source libraries that are available from various organizations. The Android SDK includes two HTTP clients, the Apache HTTP client and Java's HttpURLConnection class. The Apache HTTP client was removed in Android 6, so for new applications you should always use HttpURLConnection.
- [Instructor] To integrate an Android app with a…restful web service, you'll need to make calls over the web.…You can choose from a couple of different HTTP clients.…There are two that are included in the Android SDK,…but only one of these is recommended at this point.…Java's HttpURLConnection class and its related classes…are recommended.…You'll also see documentation for the Apache HTTP client,…but that was removed in Android 6.0.…So for new applications you should always use…HttpURLConnection, or a third-party library.…
When you use these APIs, you're using Android-specific…implementations.…For example, the public API of HttpURLConnection…is defined by Java, but the version you'll use is Android's.…When you use HttpURLConnection, you're using that and other…classes from the java.net package.…For example, you'll also use a class named URL.…And to work with the content that you retrieve over the web…you'll use classes from the package java.io.…
One interesting note is that when you use HttpURLConnection…on an Android device, in the background you're using a…
IInstructor David Gassner starts with an overview discussion about available networking strategies, and then dives into how to declare networking permissions, make network requests, handle responses, parse data returned from a web service, and pass user credentials to services that support HTTP basic authentication. He also provides an overview of popular higher-level networking libraries, including OkHttp and Picasso, and offers recommendations for improving performance in network-connected apps. David also covers using static feeds, using dynamic PHP pages hosted on a public server web service, and integrating apps with network data storage.
- Integrating mobile apps
- Communicating with Android
- Preventing app freezes with background threads
- Preparing an app for network communication
- Declaring permissions
- Checking network connectivity
- Retrieving data over the web
- Using traditional APIs
- Using third-party libraries