There are some great third-party libraries available for Android developers that are free and open source, that can improve the way you communicate on the network in Android apps. In this video I'll demonstrate OkHttp, a free open-source library created by Square. It’s a replacement for the HttpURLConnection class that offers greatly simplified coding patterns.
- [Instructor] So far in this course,…I've limited myself to using HTTP tools…that are included in the Android SDK,…primarily HttpURLConnection…and its related classes in the java.net package,…but there are some great third party libraries available…that are free and open source…that can improve the way you communicate…on the network in Android apps.…I'll start with showing OkHttp,…a free open source library created by Square.…It's a replacement for HttpURLConnection…that offers greatly simplified coding patterns.…
As I mentioned previously,…the last few versions of the Android SDK…are really using OkHttp in the background…when you code with HttpURLConnection,…but by using it explicitly,…you can greatly simplify your code.…Also, when you use OkHttp,…you won't see any change in the functionality…of your application, but the app will…automatically become more robust…because this library has the ability to…recover from failures, a critical capability…when you're working on the internet.…In this project, I'll add a dependency…
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