Open 0xSuryax opened 5 months ago
0xSurax this is the only change ? i need a solution for my app. when i try to start my service not working on android 14 - sdk 34
0xSurax this is the only change ? i need a solution for my app. when i try to start my service not working on android 14 - sdk 34
i have made the change in ForegroundService.java startService function you modify it accordingly basically define your service type.
I want foreground service for location related stuff so i have used FOREGROUND_SERVICE_TYPE_LOCATION as 2nd parameter to startForeground method.
private boolean startService(Bundle notificationConfig){
try {
int id = (int)notificationConfig.getDouble("id");
Notification notification = NotificationHelper
.getInstance(getApplicationContext())
.buildNotification(getApplicationContext(), notificationConfig);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(id, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION); //https://developer.android.com/about/versions/14/changes/fgs-types-required
} else {
startForeground(id, notification);
}
running += 1;
lastNotificationConfig = notificationConfig;
return true;
}
catch (Exception e) {
Log.e("ForegroundService", "Failed to start service: " + e.getMessage());
return false;
}
}
Sir, can you please merge this PR, its becoming urgent now. Also need to update AndroidManifest.xml REF:- service android:name="com.supersami.foregroundservice.ForegroundService" android:foregroundServiceType="location" android:exported="false"
Sir, can you please merge this PR, its becoming urgent now. Also need to update AndroidManifest.xml REF:- service android:name="com.supersami.foregroundservice.ForegroundService" android:foregroundServiceType="location" android:exported="false"
I
Sir, can you please merge this PR, its becoming urgent now. Also need to update AndroidManifest.xml REF:- service android:name="com.supersami.foregroundservice.ForegroundService" android:foregroundServiceType="location" android:exported="false"
I will have this rebuilt by today. Sorry for the delay.
To make this work in higher android versions