简体   繁体   English

如何在没有 Google Play 或用户交互的情况下自动更新 Android 应用程序

[英]How to update android app automatically without Google Play or user interaction

I'm developping an application that will run on a tablet device in a store (eg restaurant).我正在开发一个应用程序,该应用程序将在商店(例如餐厅)的平板电脑设备上运行。 The device does not have Google Play and is rooted.该设备没有 Google Play 并且已植根。 How do I install an update to my application automatically, with absolutelly NO user interaction?如何在完全没有用户交互的情况下自动为我的应用程序安装更新?

To clarify, checking for a new version of APK hosted on my server and downloading it are not part of this question, only the "silent" update part is.澄清一下,检查托管在我的服务器上的新版 APK 并下载它不是这个问题的一部分,只有“静默”更新部分是。

First of all, your device needs to be rooted.首先,您的设备需要植根。 It seems this is already done for you.看来这已经为您完成了。 Now all you have to do is to make your application check if a new version of the APK is available.现在您要做的就是让您的应用程序检查是否有新版本的 APK 可用。 If so, launch a service in background to download the required APK and run this code to silently install it.如果是这样,请在后台启动服务以下载所需的 APK 并运行此代码以静默安装它。

public static void InstallAPK(String filename){
    File file = new File(filename); 
    if(file.exists()){
        try {   
            String command;
            command = "adb install -r " + filename;
            Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", command });
            proc.waitFor();
        } catch (Exception e) {
        e.printStackTrace();
        }
     }
  }

You can basically modify the ABD command to perform whatever you want.您基本上可以修改 ABD 命令以执行您想要的任何操作。 Please note that a rooted device can be dangerous and cause security breach.请注意,root 设备可能很危险并导致安全漏洞。

暂无
暂无

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

相关问题 如何在flutter中自动更新android应用程序而无需用户交互 - How to update android app automatically without user interaction in flutter 无需用户交互即可自动更新Android应用 - Automatically update an android app without requiring user interaction 如何在没有 Google Play 的情况下更新 Android 应用程序? - How to update android app without Google Play? 如何在没有用户交互和/或应用更新的情况下更改android视图 - How to change android views without user interaction and or app update 如何在没有用户交互的情况下自动更新连续运行的Android应用 - How to auto update a continuously running Android app without user interaction Android应用程序无需用户干预即可自动投射(CastCompanionLibrary) - Android app automatically casting without user interaction (CastCompanionLibrary) 如何知道用户是否已经从Google Play更新了Android应用 - how to know user has update the Android app from google play or not 更新Android应用(不使用Google Play) - Update an Android app (without Google Play) 无需用户交互即可自动更新 APP ==> Permission Denial: not allowed to send broadcast android.intent.action.PACKAGE_ADDED - Update APP automatically without user interaction facing issue==> Permission Denial: not allowed to send broadcast android.intent.action.PACKAGE_ADDED 如何在没有用户交互的情况下以编程方式卸载Android应用程序? - How to uninstall an Android app programmatically without user interaction?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM