Home » Android » Android: DownloadManager and COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED


Posted by: admin May 14, 2020 Leave a comment


I’m trying to work around disabled Download Manager correctly. Best info I could find is How to Enable Android Download Manager.

PackageManager.COMPONENT_ENABLED_STATE_DISABLED and PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER states are quite understandable for me.

But after hour of googling I’m still confused with PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED.

Documentation reads:

Flag for setApplicationEnabledSetting(String, int, int) only: This application should be considered, until the point where the user actually wants to use it. This means that it will not normally show up to the user (such as in the launcher), but various parts of the user interface can use GET_DISABLED_UNTIL_USED_COMPONENTS to still see it and allow the user to select it (as for example an IME, device admin, etc). Such code, once the user has selected the app, should at that point also make it enabled. This option currently can not be used with setComponentEnabledSetting(ComponentName, int, int).

Does it mean that I should consider this state as enabled?

How can user select DownloadManager? How can it show up?

How to&Answers:

You can get the notify when ever DownloadManager is available setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)