initialize method
Implementation
@override
Future<bool> initialize({StepLoggerConfig? config}) async {
try {
_config = config ?? const StepLoggerConfig();
_prefs = await SharedPreferences.getInstance();
await NotificationUtils.initialize(
androidNotificationIcon: _config.androidNotificationIcon,
initialNotificationTitle: _config.trackingNotificationTitle,
);
await _loadPersistedData();
await _verifyPermissions();
// Initialize app lifecycle listener
_appLifecycleListener = AppLifecycleListener(
onResume: _handleAppResumed,
onPause: _handleAppPaused,
onDetach: _handleAppDetached,
);
// Setup periodic refresh when in foreground
_setupStepRefreshTimer();
// Restart tracking if it was active before app restart
if (_isTracking) {
await _restartTracking();
}
return true;
} catch (e) {
debugPrint('StepTracker initialization error: $e');
return false;
}
}