简体   繁体   中英

Install APK on Android using intent

I am trying to install an apk using the following code below, whenever I tried to execute the code, it only shows 'Starting...'. I don't see any notification that the apk is being installed.

Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(url));
        startActivity(intent);

Do not use Uri.parse() . Use Uri.fromFile() . If your answer to that is "it is not a file", then that is your problem -- you need to have the APK as a file, somewhere that the installer can reach it (eg, external storage).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM