Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Weather App (2015) Networking Making an HTTP GET Request with OkHttp

Can someone explain all of this to me?

So this whole stage I somewhat understood. I dont understand why we need a forecast URL, apiKEY, and what we just did in this video. I don't get what he means by the wrong way to do this or what should be the right way. AND WHY DID WE USE THE OkHttpClient for the weather? I'm lost.

1 Answer

6,509 Points

Keep in mind that the data you are reading in json for forecast is coming from some other application. In order to secure the application from possible hack, and apikey is given and there could be many possible reasons for it.

In order to get data to your mobile app, you must be able to read the data from that url and this is were OkHttp api plays an important role. There are many other APIs you can use instead of OkHttp.

Have some patience and just do what is being taught in the video, trust me it will start making sense to you once you get a hang of it.

Hope it help!

Happy coding!

Thanks. I kept watching and it did clear up. This was helpful.