When you get disconnected (use networkInfo.getDetailedState() to get
current network state), the API getDetailedState() should tell you
that you are disconnected. Try to scan for available networks
executing
mWifiMgr = (WifiManager)mContext.getSystemService
(mWifiService);
mWifiMgr.startScan();
Also implement a broadcast receiver which acts on scan results. For
example add to your onReceive method
if(intent.getAction().equals
(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)){
//Loop through the scan result and get the capability (which
authentication,key management, ...)
//select a result where the network is open (I assume you don't have
key management information)
//create a WifiConfiguration
//add the WifiConfiguration to your WifiMgr using addNetwork
//enable your new WifiConfiguration using mWifiMgr.enableNetwork
}
The last step should result in a network state change which you can
capture again in your context receiver.
--
Roman Baumgaertner
Sr. SW Engineer-OSDC
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.
On Sep 27, 6:12 pm, musunee md <[email protected]> wrote:
> Hi all,
>
> How another available wifi can be connected from program once other network
> is down?
> I got stuck in choosing from availabe wifi after 1 n/w is down.
>
> Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---