Wednesday, March 15, 2017

freedom android app

freedom android app

currently, the user has no way ofknowing they've entered a location that our server can not handle. in fact, our source code is alsoblissfully unaware of this case. we'll fix that. we'll have to add a new location status. location status invalid. but how do we know that thatlocation is unknown to the server? it turns out that with each transaction, the open weather map api returnsa code in json similar to http codes.

for success it returns 200, if the location isn't found it returnsa 404 error, location not found. so if we see a 404 error we know thatthe user has entered something that the server doesn't understand. great, we can modify the code and get weather data from jsonto understand this code. then we can set the locationstatus to the invalid state, when this response is detected.

No comments:

Post a Comment