• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            life02

              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
              197 隨筆 :: 3 文章 :: 37 評論 :: 0 Trackbacks
            public static void Install(Context ctx, String strLocalFile) {
                    Intent intentInstall 
            = new Intent();
                    String apkPath 
            = "/data/data/" + ctx.getPackageName() + "/files";
                    String apkName 
            = "yuan.apk";
                    File file 
            = new File(apkPath, apkName);
                    
            try {
            //assets下對于超過2M 的文件,有所限制,建議改名為Jpg
              InputStream is 
            = ctx.getAssets().open("yuan.apk");

                        
            if (!file.exists()) {
                            file.createNewFile();
                            FileOutputStream os 
            = ctx.openFileOutput(file.getName(),
                                    Context.MODE_WORLD_WRITEABLE);
                            
            byte[] bytes = new byte[512];
                            
            int i = -1;
                            
            while ((i = is.read(bytes)) > 0) {
                                os.write(bytes);
                            }

                            os.close();
                            is.close();
                            Log.e(
            """----------- has been copy to ");
                        } 
            else {
                            Log.e(
            """-----------cunzai ");
                        }
                        String permission 
            = "666";

                        
            try {
                            String command 
            = "chmod " + permission + " " + apkPath + "/"
                                    
            + apkName;
                            Runtime runtime 
            = Runtime.getRuntime();
                            runtime.exec(command);
                        } 
            catch (IOException e) {
                            e.printStackTrace();
                        }

                    } 
            catch (Exception e) {
                        Log.e(
            "", e.toString());
                    }
                    Log.e(
            """fl--" + file.getName() + "-dd---" + file.getAbsolutePath()
                            
            + "-pa-" + file.getPath());
                    intentInstall.setAction(android.content.Intent.ACTION_VIEW);
                    intentInstall.setDataAndType(Uri.fromFile(file),
                            
            "application/vnd.android.package-archive");
                    intentInstall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

                    ctx.startActivity(intentInstall);
                }

            當然代碼大部分參考其他人的,請見諒
            同時請參考
            http://ccsosnfs.iteye.com/blog/1390405

            posted on 2012-03-23 10:03 life02 閱讀(1044) 評論(0)  編輯 收藏 引用 所屬分類: Android開發
            丰满少妇人妻久久久久久4| 97精品国产97久久久久久免费| 久久久久人妻精品一区二区三区| 久久久久久久久久久久久久 | 色综合久久无码中文字幕| 少妇内射兰兰久久| 久久本道伊人久久| 亚洲精品国产第一综合99久久| 精品久久久无码人妻中文字幕| 久久99精品国产麻豆宅宅| 久久久久国产| 国内精品伊人久久久久av一坑| 狠狠精品干练久久久无码中文字幕| 成人综合久久精品色婷婷| 久久精品国产秦先生| 热99RE久久精品这里都是精品免费 | 99久久精品费精品国产一区二区| 一本一本久久a久久精品综合麻豆| 无码国产69精品久久久久网站| 国产精品亚洲综合专区片高清久久久| 伊人久久大香线蕉AV色婷婷色| 久久精品国产福利国产秒| 亚洲va中文字幕无码久久| 亚洲性久久久影院| 精品人妻伦九区久久AAA片69| 久久久久人妻一区精品色| 伊人久久综合无码成人网| 亚洲精品乱码久久久久久蜜桃 | 久久99精品国产一区二区三区| 久久久久高潮综合影院| 亚洲精品无码久久久| 久久97久久97精品免视看秋霞| 久久这里只有精品首页| 久久精品国产免费一区| 粉嫩小泬无遮挡久久久久久 | 久久精品成人影院| 欧美一级久久久久久久大| 久久久久久亚洲精品不卡| 久久综合亚洲色HEZYO国产| 午夜精品久久久久久影视777| 久久久久久久免费视频|