| Author |
How to handle Network Calls when there is a Weaker Network connection
|
zoheb hassan
Ranch Hand
Joined: Apr 01, 2009
Posts: 141
|
|
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
Joined: Oct 27, 2011
Posts: 10
|
|
Have you looked into the Connectivity Manager?
|
 |
zoheb hassan
Ranch Hand
Joined: Apr 01, 2009
Posts: 141
|
|
|
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
Joined: Oct 27, 2011
Posts: 10
|
|
|
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
Joined: Apr 01, 2009
Posts: 141
|
|
|
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
Joined: Oct 27, 2011
Posts: 10
|
|
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
Joined: Oct 12, 2008
Posts: 1365
|
|
|
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".
|
[List of FAQs] | [Android FAQ] | [My Blog] | [Samuh Varta]
|
 |
 |
|
|
subject: How to handle Network Calls when there is a Weaker Network connection
|
|
|