Example of the most basic method for android app to realize internal automatic update of applications

This is only a preliminary implementation, and no functions such as automatic compilation are added. You need to manually change the updated XML file and the latest APK. A total of four documents are involved! 1、 Client androidupdatetesactivity: program homepage main.xml: homepage layout update: update class softupdate_ Progress: update waiting interface

Updage

AndroidUpdateTestActivity

main.xml

softupdate_ progress.xml

Each time a new APK is generated, the version number of the system needs to be modified.

Modify version code and version name. As can be seen from the above code, the system judges whether it needs to be updated according to the version code. Version name as a version name. Here, I suggest that the version code start from 10, so that the name of the aspect can be modified (1.1, 1.2). After modification, the system is generated. Then put the APK file under the server file.

2、 The server is mainly to establish a website for users to download APK. Create a new web site on IIS

http://localhost:8011/ 。 Put the updated file and updated XML in the directory.

Version.xml format

Version corresponds to the version code of the new program; Name name casually; URL corresponds to the download path of APK.

There may be a problem here. IIS reports an error when accessing the URL path. This is mainly because IIS does not know APK and does not know how to handle it. Here, we add the MIME type of Android programs in IIS to make APK support downloading. View the established website in IIS Manager -- MIME type -- add. File extension:. APK MIME type: application / vnd.android.package-archive

So you can download it. At present, it is only a simple automatic update program. We can see that the version number needs to be filled in by yourself, and it should correspond to that in XML. APK needs to be generated and placed under the updated website. Such manual operation is easy to cause mistakes. Therefore, next, we will study how to automatically release the updated version, and the version number corresponds to SVN. After submitting SVN, we will automatically change the version number of the program.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>