Android Silent Installation application, android silent Application

Source: Internet
Author: User

Android Silent Installation application, android silent Application

APP Bao, app 360, and app pods all have a good function of downloading and installing apps on their own without the pop-up application installation dialog box. How does he do this?

Shell is used in the application, but the premise must be root. The code is simple:

  1. Public static void InstallAPK (String filename ){
  2. File file = new File (filename );
  3. If (file. exists ()){
  4. Try {
  5. String command;
  6. Command = "pm install-r" + filename;
  7. Process proc = runtime.getruntime(cmd.exe c (new String [] {"su", "-c", command });
  8. Proc. waitFor ();
  9. } Catch (Exception e ){
  10. E. printStackTrace ();
  11. }
  12. }
  13. }
Copy code
Call InstallAPK directly and give the location of the apk, for example, InstallAPK ("/sdcard/JustTest.apk ");
Success.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.