Learn iOS/Android: Networking
Explore Alamofire (iOS) and OkHttp (Android)
Published in
6 min readJul 2, 2019
Networking is a crucial component for mobile app development. Learning the basics of it from both iOS/Android platform would be handy.
Let’s look into doing some simple fetching from Wikipedia API, i.e. provide a keyword and get the count of it in Wikipedia.
The Wikipedia API
The API is https://en.wikipedia.org/w/api.php with the following parameter:
“action” = “query”,
“format” = “json”,
“list” = “search”,
"srsearch" = <Something to Provide>
https://en.wikipedia.org/w/api.php?action=query&format=json&list=search&srsearch=Networking will generate the below. Note that the totalhits
is what we want to get.
{ batchcomplete: "",
continue: {
sroffset: 10,
continue: "-||"
},
query: {
searchinfo: {
totalhits: 399303
}, ...