Welcome back in this video, we're going to look at what retrofit is in order to then being able to
use it because we're going to use it in order to get data out from the internet, which we then want
to display because the news is something that is constantly being updated, right?
And that's not something we would have locally on our PC.
So on our phone, we need to get it from the internet.
So let's look at what a retrofit is.
Therefore, we first need to understand what a restful API is.
So API stands for application programming interface, which is a set of rules that defines how applications
can communicate with each other.
And then there are rest APIs.
So representational state transfer API ice, which are restful APIs, and it is a web application programming
interface that provides a flexible way of communicating and integrating applications with online backend
or servers.
So networking in Android is mostly associated with connecting your Android application to a backend
server to ensure a user's proper data management and synchronization between all of their devices.
Applications need to connect to an online bank, and so users can have proper back up on their personal
data and easily switch devices without fear of loss of data.
So let's look at the networking process for network to be successful.
There needs to be a client and a server so a client can be any of your devices, phones or tablets,
laptops or even browser.
While the server can be any central computer or program that controls or provides the information that
you need and the client.
So your phone, for example, sends a request to the server and the server then sends a response back
with retrofit.
Connecting your Android application to an online server becomes a lot easier.
You can use its abstracted interfaces to request data and receive responses from the server.
It's a third party library because it was not created by Google, but by an external team of developers.
So let's look at retrofits most used methods that can be used to make specific requests to a rest API.
And the first one will be at Get.
So the Get method tells the server that you need to read data from it.
Then there is the post method that tells the server you need to create or add data to it.
Then there's the method that tells the server that you need to update an already existing piece of data.
And finally, we have the delete method that tells the server that you need to delete specific data
from it.
So it's actually a create, read, update and delete process, which is also known as chroot operations.
So Create C are for it you for update and D for delete.
So crude operations will learn more about using Retrofit with Android throughout the section.
So we're going to actually use Retrofit and we'll get our data from the internet in order to display
it in our application.