Can an Android app install another android app?

前端 未结 5 1828
闹比i
闹比i 2020-12-24 15:09

I was wondering if it was possible to have an android app which is already installed go and download another app and install it? I figure there could be security problems wi

相关标签:
5条回答
  • 2020-12-24 15:21

    Strictly speaking no, it is not possible: each Android package (.apk) file installed on the device is given its own unique Linux user ID, creating a sandbox for it and preventing it from touching other applications.
    If an application would "install" another one, it couldn't give to the target a new user ID. Only the system applet, running at root level, can do that.

    What the application can do is to indirectly invoke the package installer with the ACTION_VIEW intent and the application/vnd.android.package-archive MIME type: the system will launch the appropriate "viewer", which of course is the package installer.

    Nice link about that topic: http://android.amberfog.com/?p=98

    0 讨论(0)
  • 2020-12-24 15:22


    If the answer is NO. Then i wonder how facebook installs "Messenger" Application along with the "Facebook for Android" application?

    If i'm not wrong, "Messenger" is also a different application from Main Facebook app.

    Facebook For Android App will not ask to install Messenger App when we want to chat thru facebook app. It is already installed with facebook.

    You can also install/uninstall Messenger application separately.

    I may be wrong. I dont have complete information, but looking at the process and on applying little bit of logic i think we can install android application from another application. But how i'm too learning and looking for it .


    So how must they have done it? Please correct me if i'm wrong.

    0 讨论(0)
  • Try this:

    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(new File(path+"/yourapp.apk")), application/vnd.android.package-archive");
    startActivity(intent);
    
    0 讨论(0)
  • 2020-12-24 15:34

    If your app is root privlaged you can move the apk you want to install into /data/app and it will install when the device reboots

    0 讨论(0)
  • 2020-12-24 15:37

    Yes. This is how the Swype beta works. What you basically do is download the new apk, and use some Intent (not sure which) to launch the Package Installer (and at this point it is a new activity and the user has to agree to install just like downloading from the Market).

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