Android APK Installation Code

Source: Internet
Author: User
New Intent ("Android.intent.action.VIEW");//1intent.addcategory ("Android.intent.category.DEFAULT");// 2intent.setdataandtype (uri.fromfile (file),"application/vnd.android.package-archive")//3file download down the apk file stream, Application/vnd.android.package-archive is a file type that corresponds to the APK type
Startactivityforresult (Intent, 0);//4

When our project detects from the server that a new version needs to be updated, it is generally done by downloading it (file stream is downloaded in 3) and then prompting the user to install it. Here are roughly several lines of code installed at the time, as above. 12 line is the right to add the installation, the third line is the file type, specific to the APK type.

Android APK Installation Code

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.