We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Not Connected
1 parent 8889da5 commit 5cd0e12Copy full SHA for 5cd0e12
1 file changed
app/src/main/java/com/sameerasw/airsync/utils/ServiceManager.kt
@@ -36,7 +36,14 @@ object ServiceManager {
36
fun updateServiceState(context: Context) {
37
CoroutineScope(Dispatchers.IO).launch {
38
if (shouldServiceRun(context)) {
39
- AirSyncService.startScanning(context)
+ if (WebSocketUtil.isConnected()) {
40
+ // If already connected, start in sync mode so the notification correctly shows "Connected to X"
41
+ val dataStore = DataStoreManager.getInstance(context)
42
+ val lastDevice = dataStore.getLastConnectedDevice().first()
43
+ AirSyncService.start(context, lastDevice?.name)
44
+ } else {
45
+ AirSyncService.startScanning(context)
46
+ }
47
} else {
48
AirSyncService.stop(context)
49
}
0 commit comments