improve KeepAliveService

This commit is contained in:
adbenitez
2025-12-05 00:29:58 +01:00
parent d4675f25ec
commit e26ac3d264
4 changed files with 25 additions and 5 deletions
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<application>
<service
android:name=".connect.KeepAliveService"
android:foregroundServiceType="specialUse"
android:enabled="true" />
</application>
</manifest>
+5
View File
@@ -10,6 +10,11 @@
<meta-data android:name="firebase_messaging_auto_init_enabled" android:value="false" />
<application>
<service
android:name=".connect.KeepAliveService"
android:foregroundServiceType="dataSync"
android:enabled="true" />
<service
android:name=".notifications.FcmReceiveService"
android:foregroundServiceType="dataSync"
-5
View File
@@ -388,11 +388,6 @@
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize">
</activity>
<service
android:name=".connect.KeepAliveService"
android:foregroundServiceType="dataSync"
android:enabled="true" />
<service
android:name=".geolocation.LocationBackgroundService"
android:foregroundServiceType="location" />
@@ -77,11 +77,17 @@ public class KeepAliveService extends Service {
return null;
}
@Override
public void onDestroy() {
Log.i("DeltaChat", "*** KeepAliveService.onDestroy()");
// the service will be restarted due to START_STICKY automatically, there's nothing more to do.
}
@Override
public void onTimeout(int startId, int fgsType) {
stopSelf();
}
static public KeepAliveService getInstance()
{
return s_this; // may be null