简体   繁体   English

部署自定义android应用

[英]Deploy custom android app

So let's say I'm in charge of developing a custom, internal android app that will be installed via APK. 假设我负责开发一个将通过APK安装的自定义内部android应用。 What's a good way to have this thing check for updates on startup? 有什么好办法让这个东西在启动时检查更新? Should I just have it know it's version number and make a custom http request to see if a new version is available? 我是否应该知道它的版本号,并发出一个自定义的http请求以查看是否有新版本? Are there best practices for this kind of thing? 是否有针对此类情况的最佳做法?

I would do this by creating text file (xml/json) like: 我可以通过创建文本文件(xml / json)来做到这一点:

app.xml app.xml

<app>
  <date>1.1.2014</date> 
  <version>1.1</version>
  <apk>http://someurl.com/my_app.apk</apk>
</app>

Then when you update your app just upload it to your server and change that xml file to match new apk details. 然后,当您更新应用程序时,只需将其上传到服务器并更改该xml文件以匹配新的apk详细信息。

In your app you just download that xml (in startup or in background as service) and compare the version to current app version and if newer version is available just notify user and download it from app like: 在您的应用程序中,您只需下载该xml(在启动时或在后台作为服务),然后将版本与当前应用程序版本进行比较,如果有较新的版本,只需通知用户并从应用程序中下载即可,例如:

Intent intent = new Intent(Intent.ACTION_VIEW ,Uri.parse(myapk_link));
startActivity(intent); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM