• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to handle Network Calls when there is a Weaker Network connection

 
zoheb hassan
Ranch Hand
Posts: 154
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Problem here is guys that i have an android app which uses Geocoding and makes REST based Network calls, this however works flawlessly when i am using WI-FI, however when i have tried using GPRS network it does well most times but there are instances when it has failed resulting in a force close. How to handle this during situations when the network is weak like making a call again e.t.c. Any help is appreciated

Thanks & Regards
Zoheb
 
R Hoefer
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked into the Connectivity Manager?



 
zoheb hassan
Ranch Hand
Posts: 154
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Connectivity Manager is used in the app for checking Network connections if they are available or not, but the issue here is that it does well in Stronger Network connections however fails in poorer Network Connections owing to the fact that it makes Network Calls, I am curious if there is a way to make Calls again when there is a failure ??
 
R Hoefer
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean when you say 'Weak connection'? Are you saying you can't connect for a few moments or are you saying that the calls take a very long time to complete?
 
zoheb hassan
Ranch Hand
Posts: 154
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By Mentioning a "Weak Connection", I am Trying to say that its the kind of connection which has poor signal Strength and low Speed in terms of Data Transfer Which otherwise in presence of a stronger connection like Wi-fi would work fine.
 
R Hoefer
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm still not understand what you mean by weaker connection. The way I read it, I thought you were talking about a failure first and just a slow connection second. Here are a few thoughts I had.

1) Slow connection - Throw up a dialog and then use an async task to grab the data and update your UI.

2) Revisit the connectivity manager . The documentation states it can be used to "Monitor network connections (Wi-Fi, GPRS, UMTS, etc.)" and "Send broadcast intents when network connectivity changes".
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are connecting to remote servers over HTTP, one of the approaches could be setting appropriate ConnectionTimeOut and SocketTimeOut parameters. If you get ConnectionTimeOut or SocketTImedOut Exceptions you can show an informational popup to the user saying "Limited Connectivity or Slow connection".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic