I am using FusedLocationproviderClient to get my current location and
GpsStatus.Listener
to get the Gps Status using this code:
@Override
public void onGpsStatusChanged(int i) {
switch (i){
case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
@SuppressLint("MissingPermission") GpsStatus status= mLocationManager.getGpsStatus(null);
int satsused = 0;
Iterable<GpsSatellite> sats=status.getSatellites();
for (GpsSatellite sat: sats){
if (sat.usedInFix()){
satsused++;
}
}
textview.setText(String.valueOf(satsused));
if (satsused==0){
////
}
break;
}
}
This code is working fine but a few days back my phone software got crashed so I have flashed my phone to install a new software for my phone. Now my phone is working but when I tried to run this code in my app again this time the app is not working it is neither giving me current location nor Gps Status. I have also made sure that my GooglePlayService
version is latest because FusedLocationProviderClient is based on GooglePlayService
.
My app on other devices is working fine. Can anyone help me?