By convention, I wrote it above: maybe in the process of learning Android, everyone will learn a lot of basic knowledge like me, and a lot of knowledge points can also be said 123, however, these isolated points are too fragmented after all. Therefore, I want to take the most classic mobile security guard project as an example from today and exercise on my own. I also want to communicate with you, I hope everyone can give insights and make progress together. 7. Update and install the application. After the download is successful (in the onSuccess method), create a method for installing the software: code:
Private void apkInstall (File t) {Intent intent = new Intent (); intent. setAction (Intent. ACTION_VIEW); // or intent. setAction (android. intent. action. VIEW); intent. addCategory ("android. intent. category. DEFAULT "); intent. setDataAndType (Uri. fromFile (t), "application/vnd. android. package-archive "); startActivity (intent );}
Note: setData and setType cannot be used respectively.