zoukankan      html  css  js  c++  java
  • apk安装与卸载

    public void installApk() {
            /*
             * <action android:name="android.intent.action.VIEW" /> <action
             * android:name="android.intent.action.INSTALL_PACKAGE" /> <category
             * android:name="android.intent.category.DEFAULT" /> <data
             * android:scheme="file" /> <data
             * android:mimeType="application/vnd.android.package-archive" />
             */
            String fileName = Environment.getExternalStorageDirectory()
                    + "/myApp.apk";
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setDataAndType(Uri.fromFile(new File(fileName)),
                    "application/vnd.android.package-archive");
            startActivity(intent);
        }
        
        public void uninstallApk() {
            /*
            <intent-filter>  
            <action android:name="android.intent.action.DELETE" />  
            <action android:name="android.intent.action.UNINSTALL_PACKAGE" />  
            <category android:name="android.intent.category.DEFAULT" />  
            <data android:scheme="package" />  
             */
            Uri packageURI = Uri.parse("package:com.android.myapp");     
            Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);     
            startActivity(uninstallIntent); 
        }
  • 相关阅读:
    https://leetcode-cn.com/problems/binary-search/solution/er-fen-cha-zhao-by-leetcode/
    Question_add-two-numbers
    leetcode merge-two-sorted-lists
    leetcode 1108
    leetcode 1107
    git
    sql 语句
    cas
    OMP 算法
    OC----预处理器
  • 原文地址:https://www.cnblogs.com/guduey/p/4397432.html
Copyright © 2011-2022 走看看