public boolean haveNetworkConnection() { boolean haveConnectedWifi = false; boolean haveConnectedMobile = false;
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo[] netInfo = connectivityManager.getAllNetworkInfo(); for (NetworkInfo ni : netInfo) { if (ni.getTypeName().equalsIgnoreCase("WIFI")) if (ni.isConnected()) haveConnectedWifi = true; if (ni.getTypeName().equalsIgnoreCase("MOBILE")) if (ni.isConnected()) haveConnectedMobile = true; } return haveConnectedWifi || haveConnectedMobile; } On Tue, Aug 7, 2012 at 3:14 PM, Meena Rengarajan <meenasoft...@gmail.com>wrote: > Yeah, i am using device now. By programmatically, how to get Wifi status > in android ? > > > On Tue, Aug 7, 2012 at 12:52 PM, Kostya Vasilyev <kmans...@gmail.com>wrote: > >> There is no wifi in the emulator. The classes and the methods are all >> there, but they're just stubs that fail when called. >> >> You can mock WifiManager in your app, but ultimately, you will need a >> real device. >> 07.08.2012 11:03 пользователь "Meena Rengarajan" <meenasoft...@gmail.com> >> написал: >> >> I would like to check from my app whether the device has WiFi >>> connectivity, but in order to do that, I must first find a way to get >>> "WiFi" in the emulator. Just going to *Settings -> Wireless Networks -> >>> Wifi Settings *says *Unable to start Wi-Fi*, it shows error (Wifi >>> Error). >>> >>> Can anyone help me please ? >>> >>> On Tue, Aug 7, 2012 at 12:11 PM, Meena Rengarajan < >>> meenasoft...@gmail.com> wrote: >>> >>>> In my Emulator how to connect Wifi in a settings to check avaliable >>>> network connections? Can anyone tell me ? >>>> >>>> >>>> On Tue, Aug 7, 2012 at 10:16 AM, Meena Rengarajan < >>>> meenasoft...@gmail.com> wrote: >>>> >>>>> My question is, How Android mobile detects Wifi network >>>>> programmatically and if Wifi has a printer then how does it will print the >>>>> datas without changing or setting up the connections in Android mobile >>>>> through an Application? >>>>> >>>>> >>>>> On Tue, Aug 7, 2012 at 12:42 AM, bob <b...@coolfone.comze.com> wrote: >>>>> >>>>>> Perhaps you could turn off the Wifi? >>>>>> >>>>>> On Monday, August 6, 2012 6:47:28 AM UTC-5, Meena Rengarajan wrote: >>>>>>> >>>>>>> Is there any way to make the application prefers Android mobile over >>>>>>> WiFi connection? >>>>>>> >>>>>> -- >>>>>> 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 >>>>>> >>>>> >>>>> >>>> >>> -- >>> 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 >> >> -- >> 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 >> > > -- > 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 > -- 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