Re: [android-developers] Re: Internet Connection Bug Or Error ??
On Sat, Aug 21, 2010 at 1:33 AM, tarek attia tarek.m.at...@gmail.comwrote: On Sat, Aug 21, 2010 at 1:43 AM, Miguel Morales therevolti...@gmail.comwrote: Did you not read my reply? Try pinging an ip that's always up like 4.2.2.2 or similar. So you'll need a few levels of checks, first the normal check you're doing now. And then an internet reachability test to test if you can reach the internet. Thank you very much :) .I did it as you suggested.This is what worked for me :- try { address = InetAddress.getByName(www.google.com); * checkConnection = address.isReachable(6);* this method always returns false in android due to Linux privileges and something like this.So you can use HTTP timeout instead to check the Internet connection. } catch (UnknownHostException e) { guiHandler.post(noConnectionAlert); } catch (IOException e) { guiHandler.post(noConnectionAlert); } This isn't a bug in android, or some sort of error. This is a common functionality in all software. If you're connected to your router, but your router isn't connected to the internet. All the software will think it's connected to the internet and try to connect forever. (At least for software that doesn't run the check I've told you) On Fri, Aug 20, 2010 at 3:38 PM, tarek attia tarek.m.at...@gmail.com wrote: On Sat, Aug 21, 2010 at 12:43 AM, Mark Murphy mmur...@commonsware.com wrote: On Fri, Aug 20, 2010 at 4:50 PM, tarek attia tarek.m.at...@gmail.com wrote: Any Idea??? One idea is for you to have patience and not expect immediate responses to your emails. Sorry for this,but I have been with this error long time . You can try requestRouteToHost(), but I've seen some reports to suggest that it does not work very well. The best option is for you to simply try some operation on whatever server you are trying to reach. For example, download a small graphic from the Web site if you are trying to access that site's Web service. What if this server is down at this time!!! I want to show the reason of the disability either the no internet connection or the server is down ?? -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.1 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- tarek -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- http://developingthedream.blogspot.com/, http://diastrofunk.com, http://www.youtube.com/user/revoltingx, ~Isaiah 55:8-9 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- tarek -- tarek -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Internet Connection Bug Or Error ??
Besides, network connectivity can become unavailable at any time, like in the middle of your download. So checking to see if it's available at some point in time is no substitute for error handling in networking code. -- Kostya 21.08.2010 1:43, Mark Murphy пишет: On Fri, Aug 20, 2010 at 4:50 PM, tarek attiatarek.m.at...@gmail.com wrote: Any Idea??? One idea is for you to have patience and not expect immediate responses to your emails. You can try requestRouteToHost(), but I've seen some reports to suggest that it does not work very well. The best option is for you to simply try some operation on whatever server you are trying to reach. For example, download a small graphic from the Web site if you are trying to access that site's Web service. -- Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Internet Connection Bug Or Error ??
On Fri, Aug 20, 2010 at 4:50 PM, tarek attia tarek.m.at...@gmail.com wrote: Any Idea??? One idea is for you to have patience and not expect immediate responses to your emails. You can try requestRouteToHost(), but I've seen some reports to suggest that it does not work very well. The best option is for you to simply try some operation on whatever server you are trying to reach. For example, download a small graphic from the Web site if you are trying to access that site's Web service. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.1 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Internet Connection Bug Or Error ??
This is a problem for all kinds of software. Including PC software. It is not something unique to Android. The only solution I can think of is try to ping or reach an ip that is always up. On Fri, Aug 20, 2010 at 2:43 PM, Mark Murphy mmur...@commonsware.com wrote: On Fri, Aug 20, 2010 at 4:50 PM, tarek attia tarek.m.at...@gmail.com wrote: Any Idea??? One idea is for you to have patience and not expect immediate responses to your emails. You can try requestRouteToHost(), but I've seen some reports to suggest that it does not work very well. The best option is for you to simply try some operation on whatever server you are trying to reach. For example, download a small graphic from the Web site if you are trying to access that site's Web service. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.1 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- http://developingthedream.blogspot.com/, http://diastrofunk.com, http://www.youtube.com/user/revoltingx, ~Isaiah 55:8-9 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Internet Connection Bug Or Error ??
On Sat, Aug 21, 2010 at 1:25 AM, DanH danhi...@ieee.org wrote: First you have to define connected to the internet. You might be connected to the local router, eg, but it might not have a route out. You might even have a connection to a large network (eg, a university), but not be able to get past some firewall to the rest of the world. I mean by Connected to the internet to have an internet Gateway .I want to ensure that I'm connected to the internet not just a network without an internet gateway On Aug 20, 2:33 pm, tarek attia tarek.m.at...@gmail.com wrote: Hi all, In my application I must use the internet connection ,so I check it first before I open an URL connection using this :- public boolean IsConnectedToNetwork(ConnectivityManager conManager) { NetworkInfo allNetworkInfo = conManager.getActiveNetworkInfo(); NetworkInfo currNetworkInfo; boolean anythingConnected = false; for (int i = 0; i allNetworkInfo.length; i++) { currNetworkInfo = allNetworkInfo[i]; if (currNetworkInfo.getState() == NetworkInfo.State.CONNECTED) { anythingConnected=true; } } return anythingConnected; } However this code runs well when I connected to either the operator internet Or to a Wi-fi network . But when I'm connected to the operator but without credit and no internet the mobile also sees it as there's internet,or even connected to a Wi-fi network but without internet gateway it also sees as if it's connected to the internet Any Idea how can ensure that I'm connected to the internet ?? -- tarek -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- tarek -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Internet Connection Bug Or Error ??
On Sat, Aug 21, 2010 at 12:43 AM, Mark Murphy mmur...@commonsware.comwrote: On Fri, Aug 20, 2010 at 4:50 PM, tarek attia tarek.m.at...@gmail.com wrote: Any Idea??? One idea is for you to have patience and not expect immediate responses to your emails. Sorry for this,but I have been with this error long time . You can try requestRouteToHost(), but I've seen some reports to suggest that it does not work very well. The best option is for you to simply try some operation on whatever server you are trying to reach. For example, download a small graphic from the Web site if you are trying to access that site's Web service. What if this server is down at this time!!! I want to show the reason of the disability either the no internet connection or the server is down ?? -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.1 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- tarek -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Internet Connection Bug Or Error ??
On Fri, Aug 20, 2010 at 6:38 PM, tarek attia tarek.m.at...@gmail.com wrote: What if this server is down at this time!!! Then you cannot communicate to it. I want to show the reason of the disability either the no internet connection or the server is down ?? Then try a second server. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.1 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Internet Connection Bug Or Error ??
Did you not read my reply? Try pinging an ip that's always up like 4.2.2.2 or similar. So you'll need a few levels of checks, first the normal check you're doing now. And then an internet reachability test to test if you can reach the internet. This isn't a bug in android, or some sort of error. This is a common functionality in all software. If you're connected to your router, but your router isn't connected to the internet. All the software will think it's connected to the internet and try to connect forever. (At least for software that doesn't run the check I've told you) On Fri, Aug 20, 2010 at 3:38 PM, tarek attia tarek.m.at...@gmail.com wrote: On Sat, Aug 21, 2010 at 12:43 AM, Mark Murphy mmur...@commonsware.com wrote: On Fri, Aug 20, 2010 at 4:50 PM, tarek attia tarek.m.at...@gmail.com wrote: Any Idea??? One idea is for you to have patience and not expect immediate responses to your emails. Sorry for this,but I have been with this error long time . You can try requestRouteToHost(), but I've seen some reports to suggest that it does not work very well. The best option is for you to simply try some operation on whatever server you are trying to reach. For example, download a small graphic from the Web site if you are trying to access that site's Web service. What if this server is down at this time!!! I want to show the reason of the disability either the no internet connection or the server is down ?? -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.1 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- tarek -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- http://developingthedream.blogspot.com/, http://diastrofunk.com, http://www.youtube.com/user/revoltingx, ~Isaiah 55:8-9 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Internet Connection Bug Or Error ??
On Sat, Aug 21, 2010 at 1:43 AM, Miguel Morales therevolti...@gmail.comwrote: Did you not read my reply? Try pinging an ip that's always up like 4.2.2.2 or similar. So you'll need a few levels of checks, first the normal check you're doing now. And then an internet reachability test to test if you can reach the internet. Thank you very much :) .I did it as you suggested.This is what worked for me :- try { address = InetAddress.getByName(www.google.com); checkConnection = address.isReachable(6); } catch (UnknownHostException e) { guiHandler.post(noConnectionAlert); } catch (IOException e) { guiHandler.post(noConnectionAlert); } This isn't a bug in android, or some sort of error. This is a common functionality in all software. If you're connected to your router, but your router isn't connected to the internet. All the software will think it's connected to the internet and try to connect forever. (At least for software that doesn't run the check I've told you) On Fri, Aug 20, 2010 at 3:38 PM, tarek attia tarek.m.at...@gmail.com wrote: On Sat, Aug 21, 2010 at 12:43 AM, Mark Murphy mmur...@commonsware.com wrote: On Fri, Aug 20, 2010 at 4:50 PM, tarek attia tarek.m.at...@gmail.com wrote: Any Idea??? One idea is for you to have patience and not expect immediate responses to your emails. Sorry for this,but I have been with this error long time . You can try requestRouteToHost(), but I've seen some reports to suggest that it does not work very well. The best option is for you to simply try some operation on whatever server you are trying to reach. For example, download a small graphic from the Web site if you are trying to access that site's Web service. What if this server is down at this time!!! I want to show the reason of the disability either the no internet connection or the server is down ?? -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.1 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- tarek -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- http://developingthedream.blogspot.com/, http://diastrofunk.com, http://www.youtube.com/user/revoltingx, ~Isaiah 55:8-9 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- tarek -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en