Our app requires the user to allow access to the devices location.
To handle this we first check if the location service is enabled, if it's not enabled we present a view controller letting the user know that he / she needs to enable the location service to continue.
The user would then most likely put the app in the background, enable the location service, open the app again.
In the view we present to the user when location service is disabled, we would like to automatically detect if the location service has been enabled, the code below is our attempt to react to the isEnabled event.
viewDidLoad() {
super.viewDidLoad()
manager.rx
.isEnabled
.debug("isEnabled")
.subscribe(onNext: { isEnabled in
if isEnabled {
DispatchQueue.main.async {
self.dismiss(animated: true, completion: nil)
}
}
})
.disposed(by: bag)
}
When we test this by putting the app in the background then to foreground, no event is triggered.
Is this something the library is designed to handle?
If not, how would one go about creating this functionality in an app?
Our app requires the user to allow access to the devices location.
To handle this we first check if the location service is enabled, if it's not enabled we present a view controller letting the user know that he / she needs to enable the location service to continue.
The user would then most likely put the app in the background, enable the location service, open the app again.
In the view we present to the user when location service is disabled, we would like to automatically detect if the location service has been enabled, the code below is our attempt to react to the
isEnabledevent.When we test this by putting the app in the background then to foreground, no event is triggered.
Is this something the library is designed to handle?
If not, how would one go about creating this functionality in an app?