Ditto Foreground Service
Base class for the Ditto foreground service
A foreground service allows your app to continue syncing data with Ditto while running in the background.
The default implementation of this class is DefaultDittoForegroundService. It allows the foreground service notification to be customized by adding metadata to AndroidManifest.xml.
If you need further customization of the foreground service you can create your own implementation of this class.
Implementations of DittoForegroundService must override getChannelConfiguration and getNotificationConfiguration. DittoForegroundService will create a notification channel and display a foreground service notification according to the returned configurations.
Finally, the service class must be registered in AndroidManifest.xml:
<manifest>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE"
tools:targetApi="upside_down_cake" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"
tools:targetApi="tiramisu" />
<application>
<service
android:name=".MyForegroundService"
android:foregroundServiceType="connectedDevice"
android:exported="false"/>
</application>
</manifest>The foreground service is started and stopped by DittoForegroundServiceManager.
See also
Inheritors
Types
Functions
Notification channel configuration.
Notification configuration.