fix(driver-app): specify FOREGROUND_SERVICE_TYPE_LOCATION in startForeground call for Android 14/15 compatibility
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:18:11 +05:30
parent 14b87b9d12
commit 3319868eca

View File

@@ -164,7 +164,11 @@ public class TrackingService extends Service {
.setPriority(NotificationCompat.PRIORITY_HIGH)
.build();
startForeground(NOTIFICATION_ID, notification);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(NOTIFICATION_ID, notification, android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION);
} else {
startForeground(NOTIFICATION_ID, notification);
}
// 2. Acquire Power CPU WakeLock
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);