Mwas Mwas - 1 year ago 126
Android Question

Use request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN) in lower API

I need to use downloadRequest.setNotificationVisibility(Down loadManager.Request.VISIBILITY_HIDDEN); in my app which is min API 10 but the method is for API >=11.

This would be a simple comment on the question at DownloadManager.Request.setNotificationVisibility fails with jSecurityException: invalid value for visibility: 2 but then I'm yet to earn more reputation to comment on others posts.

Please guide how I can use the method in my case.

Answer Source

You cannot use that method. It did not exist prior to API Level 11 in the Android SDK, nor did its associated permission.

You can download the file yourself, using OkHttp3, HttpURLConnection, etc. Then, you are in greater control over what notifications are displayed, if any.

Or, you can conditionally call that method on supported devices:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download