'WRITE_SETTINGS intent closing after getting permission

I want to close the WRITE_SETTINGS permission intent as the user allows the permission. I have seen some apps doing this like getting permission and closing the intent automatically.

How I can achieve this functionality?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source