my app is showing the location long and lat and it is working well
but when i have to detect the location sensor status like on , of , working , error,... it have some problem
my idea was this code :
Case LocationSensor1.Sensor.State of
TSensorState.Added : label5.Text:='2';
TSensorState.Removed : label5.Text:='3';
TSensorState.Initializing : label5.Text:='4';
TSensorState.Ready : label5.Text:='ready';
TSensorState.NoData : label5.Text:='6';
TSensorState.AccessDenied : label5.Text:='7';
TSensorState.Error : label5.Text:='8';
else label5.Text:='error';
End;
but when i turn on or off the gps it is ready
every time
how can i detect and show the gps sensor status ?
You have to create a class extending the
LocationListener
class. You will be notified of the GPS status changes by two callback functions :onProviderEnabled
, which will be called when the GPS is enabled, andonProviderDisabled
when it is disabled.To register your listener, use
((LocationManager) getApplicationContext().getSystemService(Context.LOCATION_SERVICE)).requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, myLocationListener);
.