Success case
No internet
Server side issues with 500 error codes as response
User side request issues with 400 error codes as response
Cases where your network throwed a random exception like no host found
Timeout issues
Authentication failures
Retry failed requests or after re-auth
Handling null / unexpected values from response
Create user friendly error messages instead of throwing dev errors to users by parsing errors
Cancelling few requests when user goes background after calling it and few requests to run the same like analytics
making batched requests from DB
Retry with exponential backoff
Storing cache, send cache first for faster response and make actual network call + cache invalidation when new response shows up
Doing all of these when there are multiple serial + parallel background tasks / api calls running at same time.
Ensuring the transformations to create ui model from network model doesn’t create a lag in user device.
Adding observability traces to these calls
Debouncing, throttling accordingly
Handling app process deaths / crashes
unit testing , integration tests with mock / fake
load testing, test of low networks
ensuring everything is behind feature flag so app works same as before with some failures in new implementation
![Cover image for A comprehensive list of things to consinder when making a network call in mobile app](https://media.dev.to/cdn-cgi/image/width=1000,height=420,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj7359w5c697bmx8ip494.png)
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)