Ar ok, thanks :)
On Aug 13, 1:34 am, "Roman ( T-Mobile USA)" <roman.baumgaert...@t-
mobile.com> wrote:
> Sorry, forgot to define this
>
> private String mWifiService = Context.WIFI_SERVICE;
>
> For being able to obtain a WifiMgr instance you need a handle to a
> context. When you do this within your extended activity class you have
> not to worry about the context handle. You get the context with
> getBaseContext() in your activity class.
>
> --
> 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 Aug 12, 1:00 pm, SkySte <[email protected]> wrote:
>
>
>
> > Thanks :) I'll give it a try tomorrow, just a question, what is
> > mContext and mWifiService?
>
> > A little confused,
>
> > Cheers
>
> > Steve
>
> > On Aug 12, 4:52 pm, "Roman ( T-Mobile USA)" <roman.baumgaert...@t-
>
> > mobile.com> wrote:
> > > You want to use a WifiManager instead the TelephonyManager to find out
> > > about the WifiConnection state.
>
> > > Use the following APIs below
>
> > > private WifiManager mWifiMgr;
> > > mWifiMgr = (WifiManager)mContext.getSystemService(mWifiService);
> > > mWifiMgr.getConnectionInfo();
>
> > > If you are interested to find out in general whether you are connected
> > > using a radio interface you also can use the ConnectionManager.
>
> > > Hope, this helps.
>
> > > --
> > > 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 Aug 12, 7:35 am,SkySte<[email protected]> wrote:
>
> > > > Hi, My Java knowledge is very limited so it's quite an easy question
> > > > (probably) but how can I get the code below to work? I'm basically
> > > > trying to check that the device is connected to the internet to that I
> > > > can access and parse an RSS feed. This is also the 1st android app I
> > > > have written so I'm still finding my way around so any help/advice
> > > > would be appreciated.
>
> > > > I'm sure the variables should be assigned to something but I don't
> > > > know what. The classes don't appear to have public constructors so I
> > > > can't do "WifiInfo info = new WifiInfo()"
>
> > > > package com.Weather;
> > > > import android.net.wifi.WifiInfo;
> > > > import android.widget.Toast;
> > > > import android.telephony.TelephonyManager;
>
> > > > public class AirportWeather {
>
> > > > public AirportWeather() {
>
> > > > }
>
> > > > /**
> > > > * Check the device is connected to the internet
> > > > * @return int 1 = connected, 0 = not connected
> > > > */
> > > > private static int checkInternetStatus()
> > > > {
> > > > WifiInfo info;
> > > > TelephonyManager data;
> > > > Toast.makeText(null, info.getNetworkId(), 200);
> > > > if(data.getDataState() == 2)
> > > > //mobile network is connected then return 1)
> > > > {
> > > > return 1;
> > > > }else if(info.getNetworkId() != 0)
> > > > {
> > > > return 1;
> > > > }
> > > > return 0;
> > > > }
>
> > > > }
>
> > > > Thanks
> > > > Steve
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---