Silent install apk programmatically by system app (without root)

前端 未结 2 1059
伪装坚强ぢ
伪装坚强ぢ 2020-12-02 06:29

I have system-level app with android:sharedUserId=\"android.uid.system\" (UID: 1000).

Device is not rooted! INSTALL_PACKAGES permission is included to Manifest.

相关标签:
2条回答
  • 2020-12-02 06:37

    I`ve found the issue.

    1. Added "android.permission.INSTALL_PACKAGES" permission.
    2. I signed my application using "signapk.jar" with certificate that I`ve got from manufacturer of my device.
    3. And now this app can install others using "pm install /.../app.apk" without "su".

    It works!

    P.S. Updating application using just "pm install" doesn`t replace existing application with new one, but returns exit_value = 0. So to update there are two ways:

    • use "pm install -r /.../app.apk";
    • firstly delete app using "pm uninstall com.mydomain.myapp" (you need "android.permission.DELETE_PACKAGES" permission) and then install new one.
    0 讨论(0)
  • 2020-12-02 06:54

    No, you cannot. Simply having the same UID isn't enough. You must also be signed with the same key as the ROM itself.

    Silently installing apps, or updates to your own app, isn't allowed for security reasons.

    0 讨论(0)
提交回复
热议问题