i am checking gps strength in my android app. for that i use the
following code but i get no of satellite(count) is 0. and in the
getSnr is nothing displayed. how to get gps strength in android?
please assist me.
public void onCreate(Bundle savedInstanceState) {
locMgr =
(LocationManager)getSystemService(Context.LOCATION_SERVICE);
locMgr.addGpsStatusListener(onGpsStatusChange) ;
onGpsStatusChange.onGpsStatusChanged(GpsStatus.GPS_EVENT_SATELLITE_STATUS);
// Listener for GPS Status...
}
final Listener onGpsStatusChange=new GpsStatus.Listener()
{
public void onGpsStatusChanged(int event)
{
Log.e("gps","in class");
switch(event)
{
case
GpsStatus.GPS_EVENT_SATELLITE_STATUS:
GpsStatus xGpsStatus
=locMgr.getGpsStatus(null) ;
Iterable<GpsSatellite>
iSatellites =xGpsStatus.getSatellites();
Iterator<GpsSatellite> it =
iSatellites.iterator();
int count=0;
while(it.hasNext()){
count=count+1;
GpsSatellite oSat =
(GpsSatellite) it.next();
Log.e("gps",""+oSat.getSnr());
}
Log.e("count",""+count);
tv1.setText(""+count);
break;
}
}
};
--
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