android 安裝/卸載apk

1. 卸載:

           

            Uri packageURI =Uri.parse("程序完整的路徑"); 

            IntentuninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);  

            startActivity(uninstallIntent);

 

2. 安裝:

           

            String str ="apk的完整路徑";

            Intent intent = newIntent(Intent.ACTION_VIEW); 

            intent.setDataAndType(Uri.fromFile(newFile(fileName)), "application/vnd.android.package-archive");

            startActivity(intent);

 

3. 後臺靜默安裝:稍後添加...

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章