05-24-2012 11:23 AM
Hi,
Since the device cannot connect to the Internet fi Data service is set to OFF, not even with WiFI, I need to prompt an Internet Unavailable message when data services are off.
can anyone please tell me how can i do this?
I have been trying several options, but none worked.
The best advice i got so far is to use a HttpConnection ong google.com.
I think it works, but i would like something more...elegant
Regards,
Alex
Solved! Go to Solution.
05-24-2012 11:32 AM
05-24-2012 11:33 AM
Have a look into the RadioInfo class
method may help.
05-24-2012 11:39 AM
05-25-2012 12:58 AM - edited 05-25-2012 07:15 AM
H,
You can check like this also,
if(!checkCoverage() )
{
Dialog.alert("No Connection.");
}
Regards,
Lakshman
05-25-2012 06:43 AM
Hi guys,
Thank you for your replys,
Unfortunately none of the solutions you suggested worked on the device. However, lakshman9687's approach works well on the Simulator.
I am using a Torch 9860 with 3G and WiFi on and Data Services Off to test this.
Apparently the browser and the App World app seem to notice the missing of the service, so I guess there must be a way..
Thanks again for your feedback.
CHeers, Alex
05-25-2012 07:00 AM
Hi,
If u found the solution then mark as accept and close the thread other wise this thread is showing open...
Regards,
Lakshman K
05-25-2012 07:07 AM
05-25-2012 07:37 PM
"Unfortunately none of the solutions you suggested worked on the device"
You mean that they suggested there was data service when there was not or the other way round? Can you give us the results you saw and the device OS level you tested on?
05-28-2012 06:21 AM
Hi,
Apparently I was wrong. I don't really know how I tested that and got misleading results, but now I am testing it again on the same device and it appears to be working just fine.
Sorry for this.
To summarize here is the code that works:
boolean coverage_status = false; if (CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_MDS)) { coverage_status = true; } else if (CoverageInfo.isCoverageSufficient(CoverageInfo.CO VERAGE_BIS_B)) { coverage_status = true; } else if ((RadioInfo.areWAFsSupported(RadioInfo.WAF_WLAN) && WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED)) { coverage_status = true; } else if (CoverageInfo.isCoverageSufficient(CoverageInfo.CO VERAGE_DIRECT)) { coverage_status = true; } return coverage_status;
Thanks again, lakshman9687, for the solution.
Cheers,
Alex