Francis Mariano
02/23/2023, 2:55 PMFlow<Bluetooth.Availability>
. I have the following use case:
all permissions is granted, bluetooth adapter is enabled but location service is disabled.
The flow emits LocationServicesDisabled which is correct, but after I enable the LocationService, the flow could emit a new state, like Available or Unavailable(reason = Off)
What do you think about that???travis
02/23/2023, 3:18 PMFrancis Mariano
02/23/2023, 4:01 PMprivate val locationServiceEnabledFlow: Flow<Boolean> =
broadcastReceiverFlow(IntentFilter(LocationManager.PROVIDERS_CHANGED_ACTION))
.map { isLocationEnabled }
So we can combine both flows in onelocationServiceEnabledFlow
returns if the location is enabled or disabledtravis
02/23/2023, 4:16 PM