In iOS 13 Apple has introduced the API DeviceOrientationEvent.requestPermission. It must be triggered on user action (click, tap or equivalent). My problem here is that the result seems to be cached, so in case the user denies permission I can't ask access again (the promise is automatically fulfilled with the cached value). Is there any way to force the device to forgot the cached value and ask again for the user permission to access orientation data (I mean it should display again the popup window where the user can allow or deny access)?
This is the relevant code:
if (DeviceOrientationEvent && typeof(DeviceOrientationEvent.requestPermission) === "function") {
const permissionState = await DeviceOrientationEvent.requestPermission();
if (permissionState === "granted") {
// Permission granted
} else {
// Permission denied
}
}