0. preface this blog post is a continuation of the previous article. It is mainly used to modify bugs in the previous version and optimize some items to be improved. It is also regarded as a closed post. Of course, it still needs to be improved, when it is used in future projects, write it out separately. This article mainly describes the upgrade and improvement sections. Improvement 1. fixed BUG-after entering the Update page from the notification bar, press the return key-and then enter the Update page from the notification bar, the updated interface data is fully initialized. The Intent ActivityFlags is not set when you enter the download interface from the main interface. After this addition, click "Update Now" and the code is as follows: copy the code private void Download () {// go to the Download page to Download Intent intent = new Intent (); intent. setClass (this, typeof (AppUpgradeActivity); intent. setFlags (ActivityFlags. singleTop); this. startActivity (inten T);} copy Code 2. improved [Switching the notification bar and a card between the interface during the update process] Previously, the asynchronous method only implemented the update progress bar. In fact, it was a little useless. This modification was implemented using the asynchronous execution service for download, and update the progress bar, so that the back-and-forth switching is very flow, after loading the download interface, start the asynchronous thread: 3. complete [Click the notification bar after the download is complete, and the information in the notification bar does not disappear] This is relatively simple. I did not carefully study the events in the notification bar. I added it this time, set icationicationflags to AutoCancel In the downloaded event, and disable the notification bar when you click it: 4. complete [the Downloaded Program is not deleted after installation] In fact, this perfection is not directly deleted after installation, but is to check whether the installation package of the program is available when the program is started. If yes, It is deleted, the technology of direct deletion after installation is to be studied. Bypass and perfect this item first: // determine whether the downloaded file string filePath = this. getString (Resource. string. filePath); File fileDelete = new File (filePath); if (fileDelete. exists () fileDelete. delete (); 5. unfinished work 1) to be completed-operations paused during the download process not added (this process involves resumable data transfer, and you will have the opportunity to write this out separately) 2) pending improvement-network exception and timeout not handled (this is actually network connection judgment and timeout processing, and will be processed again in the actual project)