Closed Schrodingdong closed 10 months ago
The issue is that we have the LaunchedEffect
without a key. similar to react, LaunchEffect executes once and on each recomposition. When we put null as a value in the key, the launch is made only once upon composition
// Start the reminders service
LaunchedEffect(key1 = null, block = {
val serviceIntent = Intent(context, ReminderService::class.java)
serviceIntent.setAction(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS)
context.startService(serviceIntent)
})
Note : this websocket logic should be changed from composition level, to a more sophisticated level (run thread upon login)
Check why we have 2 or more executions in couroutines / launched effect tasks Example for login it causes some bugs