> and connects to a web server.  If the phone goes to sleep and one
> of my polling intervals happens the phone wakes up enough to let me
> attempt
> to connect to the network but the ConnectionManager claims there is no
> network.  Given the system log this is correct, it was torn down.

If my phone is woken up and gsm fails i try to wake up wifi:

if (!checkConnectivity()) {
                        WifiManager wm = (WifiManager) mContext
                                        .getSystemService(Context.WIFI_SERVICE);
                        mWifiLock = 
wm.createWifiLock(getClass().getSimpleName());

                        mWifiLock.acquire();

                        long start = System.currentTimeMillis();
                        while (!checkConnectivity()
                                        && System.currentTimeMillis() - start < 
10000) {
                                Sleep.sleep(1000);
                        }
                }
...
        private boolean checkConnectivity() {
                boolean mobile = mConnectivityManager.getNetworkInfo(
                                ConnectivityManager.TYPE_MOBILE).isConnected();
                boolean wifi = mConnectivityManager.getNetworkInfo(
                                ConnectivityManager.TYPE_WIFI).isConnected();
                Log.d(LOGT, "Connectivity: Mobile: " + mobile + " WiFi: " + 
wifi);
                return mobile || wifi;
        }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to