Hi,

You need to call requestLocationUpdates(... to receive data in your
listeners, see for example http://hejp.co.uk/android/android-gps-example/

Regards

On Jun 2, 3:26 pm, Murali A <mural...@greatinnovus.com> wrote:
> 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 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

Reply via email to