fix(driver-app): remove silent stopSelf on location permission warning so background tracking thread always executes
Some checks failed
Deploy RIT Freshers Hub to VPS / Deploy to Live VPS (push) Has been cancelled

This commit is contained in:
Shanmuga Krishnan S M
2026-08-04 14:31:05 +05:30
parent e5725615be
commit d81b2682b4

View File

@@ -183,15 +183,22 @@ public class TrackingService extends Service {
try {
if (locationManager != null) {
if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
try {
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 3000, 0.0f, locationListener);
} catch (SecurityException ignored) {}
}
if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
try {
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 3000, 0.0f, locationListener);
} catch (SecurityException ignored) {}
}
}
} catch (SecurityException e) {
Log.e(TAG, "SecurityException: Location permissions not granted", e);
stopSelf();
} catch (Exception e) {
Log.e(TAG, "Location permission warning", e);
Intent statusIntent = new Intent(ACTION_LOCATION_BROADCAST);
statusIntent.setPackage(getPackageName());
statusIntent.putExtra(EXTRA_STATUS, "Location Warning: " + e.getMessage());
sendBroadcast(statusIntent);
}
// 4. Start periodic 5-second uploader