Android的棉花糖回调,当用户撤消设置权限?回调、棉花、权限、用户

2023-09-06 15:49:42 作者:后知后觉i

有没有办法让回调,如果用户已经给予他们的后撤消设置权限?

我知道我们试图用相机之前,检查权限等等等等

考虑以下情形,我有需要权限读取和写入到存储设备的视频处理应用程序。处理的任务通常在秒的量级。假设用户给予权限时问及撤销他们的处理开始之后。 在这种情况下,有没有办法,我们可以得到的回调,而不是我们在检查每一次?为了让我们能够妥善处理错误情况。

解决方案   

有没有办法让回调,如果用户已经给予他们的后撤消设置权限?

没有,因为你的进程被终止。没有什么回调。

  

假设用户给予权限时问和处理开始后,撤销其

在这种情况下,你的处理突然结束,当你的进程被终止。

原来在Android中请求权限也可以有这么棒的用户体验

Is there a way to get callbacks if the user revokes permissions from the settings after having granted them?

I know we have to check for permissions before trying to use a camera etc etc.

Consider the following scenario, I have a video processing application which needs permission to read and write to storage. The task of processing is usually in the order of seconds. Assuming the user gave permissions when asked and revokes them after the processing starts. In this case is there a way we can get callbacks rather than we checking each time? Just so that we can handle the error case gracefully.

解决方案

Is there a way to get callbacks if the user revokes permissions from the settings after having granted them?

No, because your process gets terminated. There is nothing to call back to.

Assuming the user gave permissions when asked and revokes them after the processing starts

In that case, your processing ends abruptly, when your process is terminated.