Android (3)-Automatic Mono For Android App version update (2)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.