feat: enhance background streaming service with foreground handling
- Improved BackgroundStreamingService to manage foreground service notifications more effectively, ensuring compliance with Android requirements. - Implemented dynamic foreground service type resolution based on microphone permission, enhancing service behavior based on app state. - Added checks for app foreground status in connectivity management, improving responsiveness to network changes. - Refactored notification handling to streamline service lifecycle management and improve code maintainability.
This commit is contained in:
@@ -85,6 +85,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||
}
|
||||
|
||||
final authState = ref.read(authNavigationStateProvider);
|
||||
final connectivityService = ref.read(connectivityServiceProvider);
|
||||
|
||||
if (location == Routes.serverConnection) {
|
||||
return authState == AuthNavigationState.authenticated
|
||||
@@ -102,7 +103,9 @@ class RouterNotifier extends ChangeNotifier {
|
||||
final shouldShowConnectionIssue =
|
||||
!reviewerMode &&
|
||||
connectivity == ConnectivityStatus.offline &&
|
||||
authState == AuthNavigationState.authenticated;
|
||||
authState == AuthNavigationState.authenticated &&
|
||||
connectivityService.isAppForeground &&
|
||||
!connectivityService.isOfflineSuppressed;
|
||||
|
||||
if (shouldShowConnectionIssue) {
|
||||
return location == Routes.connectionIssue ? null : Routes.connectionIssue;
|
||||
|
||||
Reference in New Issue
Block a user