I use DownloadManager to get the download status, but it still does not work, it never goes into the if(c.moveToFirst())
state, and I donβt know why. Can someone help me please?
private final BroadcastReceiver myReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if(Intent.ACTION_SCREEN_OFF.equals(action)) { DownloadManager downloadMgr = (DownloadManager)getSystemService(DOWNLOAD_SERVICE); DownloadManager.Query query = new DownloadManager.Query(); query.setFilterByStatus(DownloadManager.STATUS_FAILED|DownloadManager.STATUS_PENDING|DownloadManager.STATUS_RUNNING|DownloadManager.STATUS_SUCCESSFUL); Cursor c = downloadMgr.query(query); if(c==null) {
source share