I would like to discuss one thing related to `Flow...
# juul-libraries
f
I would like to discuss one thing related to
Flow<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???
Sorry, I saw comment in thread https://github.com/JuulLabs/kable/pull/335#issue-1257820206 "Unfortunately, could not find a way to monitor changes to location services status, so only the initial emission of status is provided."
t
Ya, an unfortunate limitation on Android. If you discover a way to monitor for changes (without continually checking on an interval), then let me know.
f
@travis Look that
Copy code
private val locationServiceEnabledFlow: Flow<Boolean> =
    broadcastReceiverFlow(IntentFilter(LocationManager.PROVIDERS_CHANGED_ACTION))
        .map { isLocationEnabled }
So we can combine both flows in one
locationServiceEnabledFlow
returns if the location is enabled or disabled
t
Nice. I'll look into it. Thanks!!