本文介绍了Android App版本更新服务,而无需将其发布到市场的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我将从事一个需求很少的项目.我被要求开发一个不会上传到Playstore或任何其他Android应用商店等市场的应用.只需将其上传到云中即可在用户之间分发APK.

Recently I am going to work on a project in which the requirement is little weird. I am asked to develop a app which will not be uploaded to any marketplace like playstore or any other android app stores. It will be simply uploaded in cloud to distribute the APK among users.

在用户设备上安装应用程序后,将发布新版本时,将通知用户(通知您不要下载新版本并重新安装,而是授予权限和更新).在用户授予许可后,该应用将被更新.在没有市场帮助的情况下执行此操作的最佳方法是什么?

After the app is being installed on user device, when a new version will be released, the user will be notified (notified not to download the new version and re-install, but to grant permission and update). After the user grant permission, the app will be updated. What's the best way to do this without the marketplace help?

我的想法:

  1. 使用GCM(Google云消息传递)来通知用户并提供新版本链接.
  2. 用户将点击链接,一个新版本将被下载并替换之前的版本(Android默认版本替换)

有没有更聪明的方法来实际实现我想要实现的目标?

Is there any smarter way to do what I want to achieve actually?

推荐答案

我发现最好的方法是托管apk和具有最新版本#的文本文件.

The best way to do this I have found, was to host the apk and a text file with the latest version #.

打开应用程序,对照服务器上托管的v#检查当前v#,如果不匹配,则获取新的v#.

Opon opening the app, check the current v # against the one hosted on the server, if they dont match, grab the new one.

除非您的应用程序充当后台服务,并且您需要确保用户是否使用最新版本,否则都无需推送任何内容.

No need for pushing anything unless your app works as a background service and you need to ensure that whether the user is on the latest version whether they use it or not.

在这种情况下,您可以每天进行一次这样的服务.

If that is the case, you can have a service that does it once a day or something like that.

编辑-下载后,要安装apk,请使用以下代码.

EDIT - after downloaded, to install the apk, use the following code.

Intent promptInstall = new Intent(Intent.ACTION_VIEW)
    .setDataAndType(Uri.parse("file:///path/to/your.apk"),
                    "application/vnd.android.package-archive");
startActivity(promptInstall);

在Android上以编程方式安装应用程序

这篇关于Android App版本更新服务,而无需将其发布到市场的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 11:52