Based on your preferred interface list, I would first do a scan on Wifi. Look for open Wifi networks to connect without security codes. Otherwise open a dialog that the user can enter the security information for the secured network.
If no Wifi network is available turn off Wifi which automatically triggers to connect to cellular data. Have a broadcast receiver implemented to check for network changes. When you receive a network change you can use the code below to find out what your actual network is. To find out about your current connection: ConnectivityManager connection = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connection.getActiveNetworkInfo(); Log.d(TAG,"type: "+networkInfo.getTypeName()); To connect to a wifi network you have to create a WifiConfiguration. After adding your configuration to the WifiMgr with mWifiMgr.addNetwork(wifiConfiguration); you can connect to the network with boolean successConnected = mWifiMgr.enableNetwork(inetId, true); In your broadcast receiver you should receive an intent about the network status change. -- 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 Oct 8, 3:29 am, Gautam Tripathi <guts.gau...@gmail.com> wrote: > I need to connect my device to the network. > I have a preference order of Wifi/GPRS/dial-up modem in sequence. > How do I go about it? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---