gpt4 book ai didi

android - 使用自托管的应用程序自动更新

转载 作者:太空狗 更新时间:2023-10-29 12:54:10 27 4
gpt4 key购买 nike

我打算自行托管我的应用程序,但不确定实现自动更新的最佳方式是什么。

我打算做以下事情:

  1. 应用程序检查服务器上是否有更新的版本
  2. 如果有新版本可用 - 应用程序会将 APK 下载到设备的闪存中。
  3. ??

我的问题是如何从代码初始化更新?我知道用户需要确认此操作,但我想自己做尽可能多的工作。我是否需要调用特定的 Intent 来执行此操作?

我想问题是如果 APK 已经在设备上,我该如何以编程方式安装它..

最佳答案

I guess question is how do I install APK programmaticaly if it's already on device..

您可以使用以下代码启动安装:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(fileName)), "application/vnd.android.package-archive");
startActivity(intent);

以上代码摘自对类似问题的回答:automatic install of apk

关于android - 使用自托管的应用程序自动更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8670138/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com