简体   繁体   English

我的应用程序不在 Google Play 商店中,我可以让它自动更新吗?

[英]My app is not on the Google Play store,can I get it to auto update?

I have recently finished developing an Android application that does not qualify to be on Google Play store because it does not target a certain SDK.我最近完成了一个 Android 应用程序的开发,该应用程序不符合在 Google Play 商店中的资格,因为它不针对某个 SDK。 the app will be downloaded directly from my website, but I also want it to support automatically checking for and downloading updates.该应用程序将直接从我的网站下载,但我也希望它支持自动检查和下载更新。 is there a proper way to achieving this?有没有适当的方法来实现这一目标?

You are free to implement an own update mechanic which checks the current app version and compares it with the latest version on your server.您可以自由实施自己的更新机制,以检查当前应用程序版本并将其与服务器上的最新版本进行比较。

Alternatively, you can check out one of the existing app distribution solutions like Microsoft Appcenter.或者,您可以查看现有的应用分发解决方案之一,例如 Microsoft Appcenter。 This allows you to use the Appcenter SDK which can check at each start of the app, if the user uses the latest version.这允许您使用 Appcenter SDK,它可以在应用程序的每次启动时检查用户是否使用最新版本。

https://docs.microsoft.com/en-us/appcenter/sdk/distribute/android https://docs.microsoft.com/en-us/appcenter/sdk/distribute/android

I think you have to implement the update criteria from scratch.我认为您必须从头开始实施更新标准。 Well on app open you can check with your server if there is an update, you do this by comparing the version on the server with your versionCode if the version on your server is greater than the version code in your app then you have an update.在应用打开时,您可以检查您的服务器是否有更新,您可以通过将服务器上的版本与您的 versionCode 进行比较来做到这一点,如果您的服务器上的版本大于您应用中的版本代码,那么您就有了更新。 You can ask then the user to download the apk file, if the user accepts you download the file and use the below snippet to install it.您可以要求用户下载 apk 文件,如果用户接受您下载文件并使用以下代码段安装它。

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE, uriOfDownloadedApk);
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        startActivity(intent);
    }else{
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setDataAndType(uriOfDownloadedApk, "application/vnd.android.package-archive");
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
    }

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

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