How can I wait until DownloadManager is complete?

后端 未结 2 1594
忘了有多久
忘了有多久 2021-01-15 09:59

This is the code I\'m currently using

                String iosjiUrl = \"http://modapps.com/NotoCoji.ttf\";
                DownloadManager.Request request          


        
2条回答
  •  旧时难觅i
    2021-01-15 10:36

    Use a BroadcastReceiver to detect when the download finishes:

    public class DownloadBroadcastReceiver extends BroadcastReceiver {
    
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
    
            if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) {
                //Show a notification
            }
        }
    }
    

    and register it in your manifest:

    
        
            
        
    
    

提交回复
热议问题