Apple introduced the API DeviceOrientationEvent.requestPermission in iOS 13, requiring user action to trigger it such as a click or tap. The issue I'm facing is that once the user denies permission, the result appears to be cached, preventing me from asking for access again as the promise automatically returns the cached value. Is there a way to reset the cached value on the device and prompt the user to allow or deny access to orientation data again?
Here is the relevant code snippet:
if (DeviceOrientationEvent && typeof(DeviceOrientationEvent.requestPermission) === "function") {
const permissionState = await DeviceOrientationEvent.requestPermission();
if (permissionState === "granted") {
// Permission granted
} else {
// Permission denied
}
}