Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>AFAIK, it is possible if you have root access, the process is like following:</p> <ol> <li>Your app is in <code>/system/app</code> folder (as a system app)</li> <li><p>You need following permissions:</p> <pre><code>android.permission.INSTALL_PACKAGES android.permission.DELETE_PACKAGES android.permission.CLEAR_APP_CACHE android.permission.WRITE_EXTERNAL_STORAGE android.permission.MOUNT_UNMOUNT_FILESYSTEMS </code></pre></li> <li><p>Your app must be signed with system signature</p> <pre><code>java -jar signapk.jar platform.x509.pem platform.pk8 helloworld.apk hello.apk </code></pre></li> <li><p>Check for updates in a background thread and download updated .apk file to a temporary place, e.g <code>apk_path</code></p></li> <li><p>Execute <code>pm install apk_path</code> command programmatically, below is a snippet:</p> <pre><code>public String silentInstallation(String apkPath) { String[] args = { "pm", "install", "-r", apkPath }; ProcessBuilder processBuilder = new ProcessBuilder(args); Process process = null; InputStream errIs = null; InputStream inIs = null; try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); int read = -1; process = processBuilder.start(); errIs = process.getErrorStream(); while ((read = errIs.read()) != -1) { baos.write(read); } baos.write('\n'); inIs = process.getInputStream(); while ((read = inIs.read()) != -1) { baos.write(read); } byte[] data = baos.toByteArray(); result = new String(data); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (errIs != null) { errIs.close(); } if (inIs != null) { inIs.close(); } } catch (IOException e) { e.printStackTrace(); } if (process != null) { process.destroy(); } } return result; } </code></pre></li> </ol> <p>Hope it helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload