DEV Community

Cover image for A comprehensive list of things to consinder when making a network call in mobile app
prudhvi reddy
prudhvi reddy

Posted on

A comprehensive list of things to consinder when making a network call in mobile app

  • 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

Top comments (0)