Vijil Dhas
Vijil Dhas

Reputation: 21

Android DownloadManager class not working mobile 4G data?

I have developed an android application using Android DownloadManager Class. When I try to download file over WiFi working without issue but when I use mobile data downloading not working, showing waiting for network.

This is my code:

DownloadManager.Request request = new DownloadManager.Request(Uri.parse((urlString)));

manifest.xml permissions:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

and this is my reference page: Android DownloadManager example

Upvotes: 2

Views: 1019

Answers (1)

Sergey Emeliyanov
Sergey Emeliyanov

Reputation: 6961

From what you've provided I can only recommend you to remove the unnecessary code s.a. request.setAllowedNetworkTypes(Request.NETWORK_WIFI | Request.NETWORK_MOBILE); because it by default allows all types of network. Also make sure you haven't set setAllowedOverMetered() and setAllowedOverRoaming() to false.

Upvotes: 2

Related Questions