onStart static method
void
onStart(
- ServiceInstance service
Background service entry point (legacy; not started on Android anymore).
Implementation
@pragma('vm:entry-point')
static void onStart(ServiceInstance service) async {
DartPluginRegistrant.ensureInitialized();
debugLog('🎯 [CallBackgroundService] Background service isolate started');
Timer? heartbeatTimer;
heartbeatTimer = Timer.periodic(const Duration(seconds: 10), (timer) async {
if (service is AndroidServiceInstance) {
if (await service.isForegroundService()) {
service.setForegroundNotificationInfo(
title: 'OneCxi Call Active',
content: 'Call in progress',
);
}
}
});
service.on('stopService').listen((event) {
heartbeatTimer?.cancel();
heartbeatTimer = null;
service.stopSelf();
});
}