i’ve made a listener that checks is the GPS status is changed..
i want the listener to check if the phone is able get location at all, if now throw gps, then throw cellolar cell..
how can i add it to my listener ?
my listener:
locMgr.addGpsStatusListener(new GpsStatus.Listener()
{
public void onGpsStatusChanged(int event)
{
switch(event)
{
case GpsStatus.GPS_EVENT_STARTED:
locationStatus.setText("Location is On");
break ;
case GpsStatus.GPS_EVENT_STOPPED:
locationStatus.setText("Location is Off");
break ;
}
}
}) ;
Write a class
Now, whenever you’ll get some GPS location, it’ll come inside
onLocationChanged()method.Do not forget to add the following permissions in your manifest-
Also make sure you are adding both the location listeners GPS as well as Network like-