FEATURE ADD REQUEST: requestResolution / requestResolutionSettings should return the option selected by user, and more.
ISSUE 1:
As of now the requestResolution() method from the Hook or requestResolutionSettings() method does not return what option the user selected. It would be really helpful if those methods were promises and returned the option selected by the user. Because currently if the user selects no thanks, there is no way for us prompt again automatically.
Or if there is any other solution to my problem in the current state please suggest.
ISSUE 2:
The current checkSetting() method doesn't return true or false it returns void, there is no methods to check if LOCATION setting is turned on or not. I suggest checkSetting() method to return a boolean or add a separate method to check GPS (LOCATION) setting status of device. Or if there is a way without using listener to get the status of the mentioned setting, please let me know.
PS.: I should clarify I am not talking about location permissions, but the state of location / GPS turn on/off feature in android.
but you can use useEffect to detect that.
useEffect(() => { if (enabled) { // your code } }, [enabled])
but you can use useEffect to detect that.
useEffect(() => { if (enabled) { // your code } }, [enabled])
we need feedback to know whether the user accepted or rejected the prompt. In your example, useEffect may work in some cases, but for a safer approach, ideally requestResolution would be asynchronous and return a status.
example:
await requestResolution().then((accepted) => {
if(accepted) {
console.log("user pressed (OK)");
}
else {
console.log("user pressed (NO THANKS)");
}
})