xiaolin
xiaolin

Reputation: 31

Android 11 issue for Navigate to Settings page

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!

Upvotes: 2

Views: 396

Answers (2)

AAryz
AAryz

Reputation: 160

It is expected behavior as I have found out on google issue tracker, also here's an excerpt from google answer:

Essentially, the issue stems from Android 11’s new ‘Scoped Storage’ file management system. Below is the full explanation from Google:

“The way the filesystem and storage mounts are setup in Android R has changed significantly. When an app starts without this permission, it gets a view of the filesystem that doesn’t allow writing to certain directories (eg Android/obb). Once the app has been granted this permission, that view is no longer accurate, and needs to be updated to a view that allows the app to write to certain directories. With the way the filesystem has been setup in R, changing that view on the fly is not possible. As mentioned in comment #16, we’re evaluating internally. I’m just providing additional details why this doesn’t work the way it did on Q.”

And as far as how to solve it gracefully, I am looking for a solution myself atm.

Upvotes: 0

Related Questions