You could check the list of satellites available, if none are visible,
I'm guessing that would mean you have lost the signal.

Here's some code that may help:


        private TextView locGpsStatus = null ;
        private Integer iGpsStatus = -1 ;

.
.
.

        // Listener for GPS Status...

        private final Listener onGpsStatusChange=new GpsStatus.Listener()
        {
                public void onGpsStatusChanged(int event)
                {
                        if ( DOLOG ) Log.v("TEST","LocationActivity - 
onGpsStatusChange:
onGpsStatusChanged: " + Integer.toString(event)) ;

                        switch( event )
                        {
                        case GpsStatus.GPS_EVENT_STARTED:
                                locGpsStatus.setText("Started...") ;
                                iGpsStatus = event ;
                                break ;
                        case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
                                GpsStatus xGpsStatus = 
locMgr.getGpsStatus(null) ;
                                Iterable<GpsSatellite> iSatellites = 
xGpsStatus.getSatellites() ;
                                Iterator<GpsSatellite> it = 
iSatellites.iterator() ;
                                iSats = 0 ;                                     
// Satellite Count
                                while ( it.hasNext() )
                                {
                                        iSats++ ;
                                        it.next() ;
                                        GpsSatellite oSat = (GpsSatellite) 
it.next() ;
                                        if ( DOLOG ) 
Log.v("TEST","LocationActivity - onGpsStatusChange:
Satellites: " + oSat.getSnr() ) ;
                                }
                                if ( DOLOG ) Log.v("TEST","LocationActivity - 
onGpsStatusChange:
Satellites: " + iSats ) ;

                                break ;
                        case GpsStatus.GPS_EVENT_FIRST_FIX:
                                locGpsStatus.setText("First Fix...") ;
                                iGpsStatus = event ;
                                break ;
                        case GpsStatus.GPS_EVENT_STOPPED:
                                locGpsStatus.setText("Stopped...") ;
                                iGpsStatus = event ;
                                break ;
                        }
                }
        } ;

-John Coryat

"Radar Now!"

"What Zip Code?"

-- 
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

Reply via email to