An Android app that displays upcoming SpaceX launches for the GITMAD Networking lesson.
This app is a tutorial on how to use the Retrofit
library to make
HTTP requests within an Android App. To do this, we request upcoming
launches from the SpaceX API.
Read about the SpaceX API here: https://github.com/r-spacex/SpaceX-API
There are several TODO items throughout the code. Complete the TODO items to make the app functional.
To see the solution code, see the solution
branch.
- Add the
INTERNET
permission in AndroidManifest.xml. - Create a Retrofit service to get upcoming launches in
LaunchesService.kt
. - Set the Base URL for the API.
- Build the retrofit client and set properties.
- Assign call to the return of
getUpcomingLaunches
in LaunchesService. - Set
launchesRetriever
to theLaunchesRetriever
class instead of null. - Call
getUpcomingLaunches
onlaunchesRetriever
, passing the callback function as a parameter. - Set the type within
Response
to the type we expect the API to return.
The final app will look like this: