I am using android 11 to develop an app. In my app, I need to install other app programmatically and I need to turn on the Install unknown apps. So I just navigate to the Settings page with startactivityforresult() and Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES intent. But when I press back button after turn on the "allow from this source" option on the settings page, my app seems to restart.
Would you please let me know what the issue is, and what is the solution?
Thanks!