Notes: 18. Conclusion
Continue learning about the Networking in Android with our Android Networking: Beyond the Basics course!
The student materials have been reviewed and are updated as of July 2022.
Very well done! You’ve reached the end of the second part! :]
You’ve learned a lot of really useful concepts, which you’ll definitely use in other apps, as you work on more and more projects in the future.
You learned about Retrofit, and how to build its client, and respective ApiServices.
You also implemented different REST methods and requests, using the GET and POST annotations, and you used Query, Body and Header helper annotations.
Each of the annotations helps Retrofit generate different code underneath, with more configuration. As such, the Header annotation added headers to the request, like the authorization token.
The Query annotation appended extra parameters to the endpoint path, for the server to filter specific data. And the Body annotation specified the body parameter in each request, when you had more data to send at once.
Finally, you implemented Moshi, a cool parser which is much lighter than Gson. Along with the Moshi converter for Retrofit, you managed to fully automatize the process for parsing data from the server response to Kotlin objects, and from Kotlin objects to JSON for the server.
You’ve implemented almost every request in the RemoteApi, but there’s still more to do! In the next part, you’ll see how to add interceptors to Retrofit, to simplify your code even more, and provide more information for debugging. You’ll also implement a cleaner way to deal with errors, and another parser, which might even be easier than Moshi!